<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>快速定制</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css" media="all">
    <script src="{$Think.config.httpFlag}{$Think.config.google_map_url}" async="async"></script>
    <script src="/googlemap/googleDirectionsService.js?version=1.11"></script>
    <script src="/googlemap/googleSearchPointLatLng.js?version=0.03"></script>
    <script src="/googlemap/googleMarkerPoint.js?version=2.1"></script>
    <script>
        //获取提示
        function showDefaultTips(id) {
            layer.tips("若用车报价为0,请前往左上角用车核价设置！", "#"+id+"", {
                tips: [1, "#1E9FFF"]
            });
        }
    </script>
</head>
<style>
    #nearbyPoiMap{
        height:400px;
    }
    ul,li{ padding:0;margin:0;list-style:none}
    .disabled { pointer-events: none; }
    .addclassify {
        display: inline-block;
        width: 80px;
        height: 30px;
        border: 1px solid #ccc;
        line-height: 30px;
        /*border-radius: 40px;*/
        text-align: center;
        cursor: pointer;
        background: #1E9FFF;
        color: #fff;
    }
    .addnumsty {
        /*background: #00a0e9;*/
        position: absolute;
        left: -11px;
        top: 10px;
        background: #1E9FFF;
        color: #fff;
        display: inline-block;
        width: 32px;
        height: 32px;
        border: 1px solid #1E9FFF;
        line-height: 32px;
        border-radius: 32px;
        text-align: center;
        cursor: pointer;
    }
    .layui-form-select .layui-edge {
        display: none;
    }
    .travelulone{
        display: flex;
        margin-bottom: 20px;
    }
    .travelultwo{
        display: flex;
    }
    .travelulone li{
        width: 30%;
        /*border: 1px solid rgba(221, 221, 221, 0.99);*/
    }
    .travelultwo li{
        width: 30%;
        /*border: 1px solid rgba(221, 221, 221, 0.99);*/
    }
    .addli{
        position: relative;
    }
    .deleteDay{
        position: absolute;
        right: 40px;
        top: 0;
    }
    .deleteDay i{
        color: red;
        font-size: 18px;
    }
    .ActionButton{
        z-index: 2;
        position: fixed;
        right: 20px;
        bottom: 140px;
        min-width: 125px;
    }
    .Actiondiv{
        /*display: inline-block;*/
        height: 38px;
        line-height: 38px;
        padding: 0 18px;
        background-color: #1E9FFF;
        color: #fff;
        white-space: nowrap;
        text-align: center;
        font-size: 14px;
        border: none;
        border-radius: 2px;
        cursor: pointer;
        -webkit-box-shadow: 0 2px 8px rgba(0,0,0,.15);
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
        /*margin-bottom: 5px;*/
    }
    .layui-card-header{
        color: #ff7d00;
        font-weight: bold;
        font-size: 20px;
    }
    .layui-card-body{
        padding: 10px 50px;
    }
    .custom_input{
        width: 180px;
        border: 1px solid #cccccc;
        border-radius: 5px;
    }
    .material_data{
        /*border: 1px solid #CCCCCC;*/
        /*margin: 20px;*/
    }
    .unifybut{
        border: 1px solid #2196f3;
        text-align: center;
        margin-left: 40px;
        margin-bottom: 20px;
        width: 50px;
        height: 30px;
        line-height: 30px;
        border-radius: 5px;
        color: #fff;
        background:#2196f3;
    }
    .unifydelbut{
        border: 1px solid red;
        text-align: center;
        margin-left: 40px;
        margin-bottom: 20px;
        width: 50px;
        height: 30px;
        line-height: 30px;
        border-radius: 5px;
        color: #fff;
        background: red;
    }
    .unifybutadd{
        /*border: 1px solid #2196f3;*/
        text-align: center;
        /*margin-left: 12px;*/
        /*margin-bottom: 20px;*/
        width: 30px;
        height: 30px;
        line-height: 30px;
        /*border-radius: 2px;*/
        color: #fff;
        background: #ccc;
    }
    .layui-card-body span{
        font-size: 12px;
        line-height: 30px;
    }
    .layui-input{
        border-radius: 5px;
        height: 30px;
    }
    .layui-select-title{
        height: 30px;
    }
    .layui-form-label{
        line-height: 12px;
    }
    .deletePoi{
        margin-left: 80px;
        display: none;
    }
    .messdiv{
        height: 40px;
    }
    .messdiv:hover .deletePoi{display: block;}
    /*.messdiv:hover .detail-create-list*/
    /*{display: block;}*/
    .custom_input_s {
        width: 180px;
        border-radius: 5px;
    }
    .layui-select-title input{
        border: 1px solid #ccc;
    }
    .partitionBox{
        display: flex;
    }
    /*右侧css*/
    .poi-detail{
        /*display: flex;*/
    }
    .poi-detail-item{
        font-size: 12px;
        padding: 8px;
        display: inline-block;
        vertical-align: top;
        border: 1px solid #dfdfdf;
        width: 30%;
    }
    .poi-detail-item-imgbox{
        max-width: 200px;
        position: relative;
        margin: 0 auto;
    }
    .poi-detail-item-imgbox img{
        width: 100%;
        height: 100px;
    }
    .poi-detail-item p{
        text-align: center;
        /*max-width: 200px;*/
        line-height: 18px;
        font-size: 12px;
    }
    .poi-detail-item p:nth-child(3)
    {
        font-size: 14px;
    }
    .poi_img_shadow {
        border: 3px solid #a7ff19;
        top: 0px;
        position: absolute;
        /* left: 167px; */
        width: 75px;
        display: none;

    }
    .poicheckeds{
        display:none;
    }
    .schedule_title{
        width: 100%;
    }
    .messdiv .layui-form-label{
        width: 20px;
    }
    .poi-p-list-box{
        height: 30px;
        padding: 0 5px;
        color: #999;
    }
    .poi-detail{
        /*padding:0 20px;*/
    }
    .btnfix{
        z-index: 999;
        position: fixed;
        right: 0px;
        bottom: 80px;
        min-width: 75px;
    }
    .btnfix img{
        width: 50px;
        height: 50px;
    }
    .poibtnshow{
        display: block;
        z-index:999;
    }
    .dragUp,.dragDown{
        height: 30px;
        line-height: 30px;
        /*background: #ff7d00;*/
        text-align: center;
        /*color: #fff;*/
        margin-bottom: 3px;
        box-shadow: 0px 7px 7px -7px #5E5E5E;
    }
    .dragUpPricing,.dragDownPricing{
        height: 30px;
        line-height: 30px;
        /*background: #ff7d00;*/
        text-align: center;
        /*color: #fff;*/
        margin-bottom: 3px;
        box-shadow: 0px 7px 7px -7px #5E5E5E;
    }
    .rightPoiInfo_item{
        width: 100%;
        line-height: 30px;
        font-size: 13px;
        margin-bottom: 8px;
    }
    .rightPoiInfo_item label{
        float:left;
        font-weight: bold;
        width: 80px;
        text-align: right;
    }
    .rightPoiInfo_item>span{
        display: block;
        margin-left: 80px;
        color: #999;
    }
    .ticketInfo_item{
        width: 100%;
        line-height: 30px;
        font-size: 13px;
        margin-bottom: 8px;
    }
    .ticketInfo_item label{
        float:left;
        font-weight: bold;
        width: 80px;
        text-align: right;
    }
    .ticketInfo_item>span{
        display: block;
        margin-left: 80px;
        color: #999;
    }
    .rightPoiInfo_item input{
        width: 500px;
    }
    .rightPoiInfo_item textarea{
        resize: none;
        width: 500px;
        height: 50px;
    }
    #poi_name{
        font-weight: bold;font-size: 20px;margin-left:58px;
    }
    #poi_engname{
        color:#666;font-size: 13px;margin-left:58px;margin-bottom:10px;
    }
    #poi_introduce{
        max-height: 110px;
        overflow: scroll;
        overflow-x: hidden;
        border:1px #eee solid;
        padding: 8px;
    }
    .poi-detail-item-title{
        font-size: 24px !important;
        max-width:200px;
        line-height:30px !important;
    }
    .poi-detail-item-title1{
        font-size: 18px !important;
        max-width:200px;
        line-height:30px !important;
    }
    #rightmap{
        width:100%;
        height:300px;
        line-height: 30px;
        text-align: center;
        display: none;
        margin-bottom:20px;
    }
    #poi_introduce p span{
        margin:0;
    }
    #rightNewPOI .layui-input-inline{
        width: 60%;
    }
    .addressbox,.addressbox span{
        width:100%;
        background: #dfdfdf;
    }

    /*详细定制得样式*/
    .detail-custom-trip{
        display: inline-block;
        float: left;
        margin-right: 10px;
    }
    .layui-form-text{
        display: inline-block;
    }
    .detail-create{
        font-weight: bold;
        color: #fff;
        width: 50px;
        line-height: 1.5;
        display: inline-block;
        font-weight: 400;
        text-align: center;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
        background-image: none;
        border: 1px solid transparent;
        white-space: nowrap;
        padding: 0 15px;
        font-size: 14px;
        border-radius: 4px;
        height: 28px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-transition: all .3s cubic-bezier(.645,.045,.355,1);
        transition: all .3s cubic-bezier(.645,.045,.355,1);
        /*position: relative;*/
        color: rgba(0,0,0,.65);
        background-color: #fff;
        border-color: #ccc;
    }
    .detail-create span{
        font-weight: bolder;
    }
    .detail-create-list{
        list-style: none;
        display: none;
        outline: 0;
        position: absolute;
        padding: 0 !important;
        margin-top: 10px;
        width: 270px;
        text-align: center;
        background-color: #fff;
        border-radius: 4px;
        -webkit-box-shadow: 0 2px 8px rgba(0,0,0,.15);
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
        background-clip: padding-box;
        z-index: 99999 !important;
    }
    .detail-create-list :hover{
        background: #e3e3e3;
    }
    .detail-create-list li{
        float: left;
        width: 82px;
        list-style: none !important;
        padding: 6px 0;
        margin: 4px !important;
        text-align: center;
        /*clear: both;*/
        font-size: 14px;
        font-weight: 400;
        color: rgba(0,0,0,.65);
        white-space: nowrap;
        cursor: pointer;
        -webkit-transition: all .3s;
        transition: all .3s;
        line-height: 22px;
    }
    .detailcustomshow{
        display: block;
    }
    /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
    ::-webkit-scrollbar
    {
        width: 5px;  /*滚动条宽度*/
        /*height: 5px;*/
    }

    /*定义滚动条轨道 内阴影+圆角*/
    ::-webkit-scrollbar-track
    {
        /*滚动条的背景区域的内阴影*/
        box-shadow:0px 1px 3px rgba(0,0,0,0.3) inset;

        /*滚动条的背景区域的圆角*/
        border-radius: 10px;

        /*滚动条的背景颜色*/
        background-color: #ddd;
    }

    /*定义滑块 内阴影+圆角*/
    ::-webkit-scrollbar-thumb
    {
        /*滚动条的内阴影*/
        box-shadow:0px 1px 3px rgba(0,0,0,0.3) inset;

        /*滚动条的圆角*/
        border-radius: 10px;

        /*滚动条的背景颜色*/
        background-color: #1E9FFF;
    }
    .border-d2{
        border: 1px solid #d2d2d2;
        padding: 8px;
    }
    .item-toggle,.hideDayMapBtn{
        float: right;
        color: #009688;
    }
    .uploadimgbox img{
        height: 60px;
    }
    .distance{
        height: 20px;
    }
    .distance-list{
        height: 20px;
        margin-top: -25px;
        margin-bottom: 7px;
    }
    .distance-list-car{
        font-size: 12px;
        color: #CCCCCC;
    }
    .allImgArr,#poiImgShow{
        width: 500px;
        min-height: 80px;
    }
    .allImgArr img{
        width: 90px;
        height: 60px;
    }
    .allImgArr{
        padding: 8px;
        background: #eee;
    }
    #poiImgShow i{
        color:red
    }
    .activeinput{
        background: #ffe9001a;
        /*border: 1px solid #ffe9001a;*/
    }
    .rightPoiInfo_item_submit{
        text-align: center;
        background: #009688;
        width: 30%;
        margin-top: 20px;
        /*margin-left: 22%;*/
    }
    .rightPoiInfo_item_span{
        width: 500px;
        text-align: center;
    }

    /*包车自驾样式*/
    .layui-Travel{
        padding: 10px;
        /*transform:rotateX(180deg);*/
    }
    /*滑块得高度*/
    .noUi-vertical .noUi-handle{
        top: 0;
        height: 17px;
        background: #1E9FFF;
    }
    /*交通配置样式*/
    .trafficCar{
        margin-left: 10px;
        font-size: 14px;
        color: #999;
        display: inline-block;
        width: 350px;
        min-height: 30px;
        /*padding: 1px 0;*/
        /*text-align: center;*/
        /*background: #eee;*/
        border-radius: 5px;
        border: 1px dotted #999999;
    }
    .layui-timeline-title{
        height:auto;
        min-height: 30px;
        line-height: 30px;
    }
    .trafficCar p{
        background: #ff98008f;
        /* width: 60px;
         height: 22px;
         line-height: 22px;
         padding: 0 5px;
         font-size: 12px;
         color: #fff;
         background: #1E9FFF;*/
    }
    .trafficCar_label{
        font-size:16px;
        padding: 0 8px;
    }
    .trans_type_close{
        float: right;
        margin-right: 20px;
        color:red;
    }
    .activetrafficCar{
        border: 2px solid #1E9FFF;
    }
    .box-price{
        /*width: 98.5%;*/
        min-height: 820px;
        margin:0 auto;
        padding: 0 5px;
        overflow-x: scroll;
    }
    /*去掉表格鼠标滑过得样式 .layui-table-hover*/
    .layui-table tbody tr:hover{
        background: #fff;
    }

    .table-input{
        margin-top:5px;
    }
    .table-input-text{
        margin-top:5px;
    }


    /* .switcherset{
         display: none;
     }*/
    .box-price ::placeholder{
        color: #CCCCCC;
    }
    .staff-not{
        text-align: center;
    }

    .inblock{
        display: inline-block;
    }
    .hotel-dealis{
        margin-top: 5px;
    }
    .hidden{
        display: none
    }
    #summaryPricingTable td input{
        width:70%;
        margin-left: 0px;
    }
    .money-unit-symbol{
        float: left;
        height: 30px;
        line-height: 30px;
        margin-right:0px;
    }
    .staff-have{
        display: none;
    }
    .symbolPrice{
        height: 30px;
        line-height: 30px;
        display: inline-block;
    }
    .money-unit-symbol-Price{
        display: inline-block;
        margin-right:0px;
    }
    .totalCarPrice{
        height: 30px;
        line-height: 30px;
    }


    /*遮罩*/
    .box{
        display: none;
        position:absolute;
        top:0;
        bottom:0;
        left:0;
        right:0;
        background:#000;
        opacity:0.4;
        width: 100%;
        height: 100%;
        z-index: 11;
        text-align: center;
    }
    .box img{
        width: 90%;
        height: 100%;
    }
    .setReturnJourney{
        font-size: 10px;
        color:#1E9FFF;
    }

    .radius_div{
        display:inline-block;
        float:left;
        font-size:14px;
        margin-top:1px;
        margin-right:5px;
        width: 22px;
        height: 22px;
        border: 1px solid blue;
        border-radius: 22px;
        /*background-color: #0FF;*/
        opacity: 0.5;
    }
    .layui-container{
        width: 100%;
        margin: 0 0 10px 0;
    }
    .layui-container label{
        vertical-align: sub;
    }
    .day-description{
        min-height: 100px;
        line-height: 20px;
        padding: 6px 10px;
        resize: none;
        width : 475px;
        margin: 0 0 10px 10px;
        border-radius: 5px;
    }
    .required_input:before{
        content: '*';
        font-weight: bold;
        color:red;
    }
</style>
<link rel="stylesheet" href="__PUBLIC__/drag/drag.css"  media="all">
<body>
<div>
    {if isset($trip.is_template) && $trip.is_template == 1}
    <div class="layui-card" style="margin:8px auto;text-align: center;font-size: 16px;color:#ff7d00">
        该定制为模板行程,只可查看不允许修改,
        如需使用，请前往模板列表点击【复制】
    </div>
    {/if}
    <div class="layui-card">
        <form class="layui-form " id="customer" action="">
            <input type="hidden" id="tripid" name="tripid" value="{notempty name='$tripid'}{$tripid}{/notempty}" autocomplete="off">
            <div>
                <div class="layui-card-header">行程信息</div>
                <div class="layui-card-body">
                    <ul class="">
                        <div class="layui-container">
                            <div class="layui-row">
                                <div class="layui-col-md12 ">
                                    <label class="required_input">方案名称：</label>
                                    <input name="name" id="name" value="{notempty name='$trip.name'}{$trip.name}{/notempty}" lay-verify="required" placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text" style="width:600px;">
                                </div>
                            </div>
                        </div>
                        <div class="layui-container">
                            <div class="layui-row">
                                <div class="layui-col-md3">
                                    <label>出行天数：</label>
                                    <input name="days" id="days" value="{notempty name='$trip.days'}{$trip.days}{/notempty}" lay-verify="required" placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text" disabled>
                                </div>
                                <div class="layui-col-md3">
                                    <label class="required_input">出行日期：</label>
                                    <input name="start_go_time" id="start_go_time" value="{notempty name='$trip.start_go_time'}{$trip.start_go_time}{/notempty}"   lay-verify="required" id="start_go_time"  placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline"  type="text">
                                </div>
                                <div class="layui-col-md3">
                                    <label>结束日期：</label>
                                    <input name="end_go_time" id="end_go_time" value="" lay-verify="required" id="end_go_time"  placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline"  type="text" disabled>
                                </div>
                            </div>
                        </div>
                        <div class="layui-container">
                            <div class="layui-row">
                                <div class="layui-col-md3">
                                    <label>出发城市：</label>
                                    <div class="layui-input-inline custom_input_s ">
                                        <select name="start_city" lay-verify="start_city" lay-search class="">
                                            <option value="" class="custom_input" style="height: 30px;border: 1px solid #ccc">请选择</option>
                                            {volist name="city" id="vo"}
                                            <option class="custom_input" style="height: 30px;border: 1px solid #ccc" value="{$vo.id}" {notempty name='$trip.start_city'}{if $trip.start_city==$vo.id}selected{/if}{/notempty}>{$vo.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-md3">
                                    <label>目的城市：</label>
                                    <div class="layui-input-inline custom_input_s">
                                        <select name="end_city" lay-verify="end_city" lay-search>
                                            <option value="">请选择</option>
                                            {volist name="city" id="vo"}
                                            <option value="{$vo.id}" {notempty name='$trip.end_city'}{if $trip.end_city==$vo.id}selected{/if}{/notempty}>{$vo.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-md3">
                                    <label>车型选择：</label>
                                    <div class="layui-input-inline custom_input_s">
                                        <select name="carType" id="carType" lay-filter="carType" lay-search>
                                            <option value="0">请选择</option>
                                            <option value="1"  {notempty name="$trip.carType"}{if $trip.carType=='1'} selected{/if}{/notempty}>5座</option>
                                            <option value="10" {notempty name="$trip.carType"}{if $trip.carType=='10'} selected{/if}{/notempty}>7座</option>
                                            <option value="15" {notempty name="$trip.carType"}{if $trip.carType=='15'} selected{/if}{/notempty}>8座</option>
                                            <option value="20" {notempty name="$trip.carType"}{if $trip.carType=='20'} selected{/if}{/notempty}>12座</option>
                                            <option value="30" {notempty name="$trip.carType"}{if $trip.carType=='30'} selected{/if}{/notempty}>15座</option>
                                            <!--<option value="40" {notempty name="$trip.carType"}{if $trip.carType=='40'} selected{/if}{/notempty}>20座以上</option>-->
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-container">
                            <div class="layui-row">
                                <div class="layui-col-md3">
                                    <label>成人数量：</label>
                                    <input name="adult" value="{notempty name='$trip.adult'}{$trip.adult}{/notempty}" placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text" autocomplete="off">
                                </div>
                                <div class="layui-col-md3">
                                    <label>儿童数量：</label>
                                    <input name="child" value="{if isset($trip.child) && $trip.child>=0}{$trip.child}{/if}" placeholder="" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text" autocomplete="off">
                                </div>
                            </div>
                        </div>
                    </ul>
                </div>
                <!--<div class="layui-card-header">客户信息</div>-->
                <!--<div class="layui-card-body">-->
                    <!--<ul class="">-->
                        <!--<div class="layui-container">-->
                            <!--<div class="layui-row">-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="required_input">客户姓名：</label>-->
                                    <!--<input name="nickname" value="{notempty name='$customer.nickname'}{$customer.nickname}{/notempty}" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text">-->
                                <!--</div>-->
                                <!--<div class="layui-col-md6">-->
                                    <!--<label class="required_input">联系方式：</label>-->
                                    <!--<div class='layui-inline' style="width:100px;">-->
                                        <!--<select name="country_code" id="country_code" class="layui-select" >-->
                                            <!--<option value="">电话区号</option>-->
                                            <!--{volist name='phoneCodeList' id='value'}-->
                                            <!--<option value="{$value.code}" {notempty name='$customer.country_code'}{if $value['code']==$customer['country_code']}selected{/if}{/notempty}>{$value.codeName}</option>-->
                                            <!--{/volist}-->
                                        <!--</select>-->
                                    <!--</div>-->
                                    <!--<input style="width:200px" name="phone" value="{notempty name='$customer.phone'}{$customer.phone}{/notempty}" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text">-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="layui-container">-->
                            <!--<div class="layui-row">-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="required_input">来源平台：</label>-->
                                    <!--<div class="layui-input-inline custom_input_s">-->
                                        <!--<select name="source" id="source" class="layui-select custom-input" lay-search="">-->
                                            <!--<option value="">请选择来源</option>-->
                                            <!--{volist name='originList' id='value'}-->
                                            <!--<option value="{$key}" {if $key==$customer['source']}selected{/if}>{$value}</option>-->
                                            <!--{/volist}-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="">&nbsp;邮箱地址：</label>-->
                                    <!--<input name="email" value="{notempty name='$customer.email'}{$customer.email}{/notempty}" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text">-->
                                <!--</div>-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="">&nbsp;&nbsp;年&nbsp;&nbsp;龄&nbsp;&nbsp;&nbsp;&nbsp;：</label>-->
                                    <!--<input name="age" value="{notempty name='$customer.age'}{$customer.age}{/notempty}" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text">-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="layui-container">-->
                            <!--<div class="layui-row">-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="">&nbsp;出行类型：</label>-->
                                    <!--<div class="layui-input-inline custom_input_s">-->
                                        <!--<select name="type" lay-verify="type" lay-search>-->
                                            <!--<option value="person" {notempty name='$customer.type'}{if $customer.type=='person'}selected{/if}{/notempty}>个人</option>-->
                                            <!--<option value="team" {notempty name='$customer.type'}{if $customer.type=='team'}selected{/if}{/notempty}>团体</option>-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!--<div class="layui-col-md3">-->
                                    <!--<label class="">&nbsp;&nbsp;微&nbsp;&nbsp;信&nbsp;&nbsp;&nbsp;&nbsp;：</label>-->
                                    <!--<input name="wechat" value="{notempty name='$customer.wechat'}{$customer.wechat}{/notempty}" autocomplete="off" class="layui-input custom_input layui-input-inline" type="text">-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</ul>-->
                <!--</div>-->
                <div class="material_data">
                    <button class="unifybut" lay-submit lay-filter="customer">更新</button>
                </div>
            </div>
        </form>
        <div style="width: 100%;height: 1px;background: #efefef"></div>
        <div class="dragUp"><span>行程信息&nbsp;&nbsp;&nbsp;&nbsp;</span><img src="/icon/up.gif" width=25 height=25 alt=""></div>
        <div class="dragDown"><span>行程信息&nbsp;&nbsp;&nbsp;&nbsp;</span><img src="/icon/down.png" width=25 height=25 alt=""></div>
        <!--行程方案板块-->
        <div class="Travel-plan">
            <div class="layui-card-header">行程方案
                <span style="font-size:12px;color:red;">（小技巧：POI节点左侧圆点可拖拽排序）</span>
            </div>
            <div class="layui-card-body partitionBox" style="padding: 10px 5px;">
                <!--左中侧数据-->
                <div class="box-left" style="width: 50%;height: 580px;overflow: auto;padding-left: 15px;">
                    <form class="layui-form" id="tripmake">
                        <ul class="layui-timeline" style="height: 100%">
                            {notempty name="$schedule"}
                            {volist name="schedule" id="vo"}
                            <li class="layui-timeline-item addli" id="li_{$vo.id}">
                                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                                <input type="hidden" class="schedule_id" data-day="{$vo.dayNum}" value="{$vo.id}" autocomplete="off">
                                <div class="layui-timeline-content layui-text">
                                    <h3 class="layui-timeline-title">
                                        <span style="font-size:18px !important;vertical-align:top;">DAY{$vo.dayNum}</span>
                                        <a data-id="{$vo.id}" class="layui-btn-info layui-btn layui-btn-xs getDayMap layui-btn-normal " style="margin-left: 10px;vertical-align:top;margin-top:4px;">显示地图</a>
                                        <div data-id="{$vo.id}" data-type="{$vo.transport_typeids}" class="trafficCar trafficCar_{$vo.id} hidden">
                                            <span class="trafficCar_label">请选择交通类型:</span>
                                            {volist name='vo.transportList' id='trans_myv'}
                                            <p class="layui-btn-info layui-btn layui-btn-xs layui-btn-normal trafficCar_item" data-id="{$trans_myv.id}" >{$trans_myv.title}<i class="layui-icon"></i></p>
                                            {/volist}
                                        </div>
                                    </h3>
                                    <span class="deleteDay "><i class="layui-icon layui-icon-close">&#x1006;</i></span>
                                </div>
                                <div class="layui-form-item" >
                                    <label class="layui-form-label" style="width:130px;">{$vo.time}&nbsp;&nbsp;{$vo.week}</label>
                                    <div class="layui-input-inline" style="width:350px;">
                                        <input type="text" class="layui-input schedule_title" placeholder="请输入标题" value="{notempty name='$vo.title'}{$vo.title}{/notempty}" autocomplete="off">
                                    </div>
                                </div>
                                <div class="layui-timeline-content layui-text">
                                    <textarea data-id="{$vo.id}" class="layui-textarea day-description"  placeholder="请输入当天的简要说明">{notempty name='$vo.day_description'}{$vo.day_description}{/notempty}</textarea>
                                </div>
                                <div class="layui-timeline-content layui-text adddivadd dragsort_div">
                                    <div id="{$vo.id}_did">
                                        {notempty name="$vo.active"}
                                        {volist name="$vo.active" id="active"}
                                        <div class="a_div" id="{$active.id}_aid">
                                            <div class="layui-form-item messdiv">
                                                <div class="radius_div">
                                                    <div class="keyNumber" style="text-align: center;"></div>
                                                </div>
                                                <input type="hidden" class="active_id" value="{$active.id}" data-day="{$vo.dayNum}" data-sid="{$vo.id}">
                                                <!--添加详细定制下拉信息-->
                                                <!--<label class="layui-form-label">POI</label>-->
                                                <!--详细定制 detail-custom用于来一键切换操作这个class 这个class不用于任何js事件 纯操作class-->
                                                <div class="detail-custom-trip detail-custom">
                                                    <input type="hidden" class="activeType" value="{$active.activeType}" autocomplete="off">
                                                    <div class="detail-create">
                                                        <span>
                                                            {notempty name="$poiClassifyList"}
                                                            {volist name="$poiClassifyList" id="value"}
                                                            {if $active.activeType==$value.id}
                                                            {$value.name}
                                                            {/if}
                                                            {/volist}
                                                            {/notempty}
                                                        </span>
                                                    </div>
                                                    <ul class="detail-create-list">
                                                        {notempty name="$poiClassifyList"}
                                                        {volist name="$poiClassifyList" id="value"}
                                                        <li class="detail-create-list-item" value="{$value.id}">{$value.name}</li>
                                                        {/volist}
                                                        {/notempty}
                                                    </ul>
                                                </div>
                                                <div class="layui-input-inline" style="width:165px;">
                                                    <select name="city_{$active.id}" lay-filter="city" lay-search class="city_slt" autocomplete="off" >
                                                        <option value="">城市</option>
                                                        {volist name="city" id="vo1"}
                                                        <option value="{$vo1.id}" {notempty name='$vo1.id'}{if $active.cityid==$vo1.id} selected{/if}{/notempty}>{$vo1.name}</option>
                                                        {/volist}
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline selectpoilist" style="width:220px;">
                                                    {if $active.activeType==6}
                                                    <input data-id="{$active.id}" data-type="6" class="layui-input" type="text" name="other" placeholder="标题" value="{$active.title}" autocomplete="off">
                                                    {else}
                                                    <select data-id="{$active.id}" data-type="{$active.activeType}" name="activeSelect_{$active.id}" lay-filter="activeSelect" lay-search class="activeSelect_slt" id="activeSelect_{$active.id}" data-day="{$vo.dayNum}" data-sid="{$vo.id}">
                                                        <option value="">POI</option>
                                                        {notempty name="$active.poiArr"}
                                                        {volist name="$active.poiArr" id="vo2"}
                                                        <option value="{$vo2.id}" {notempty name='$vo2.id'}{if $active.poiid==$vo2.id} selected{/if}{/notempty}>{$vo2.name}</option>
                                                        {/volist}
                                                        {/notempty}
                                                    </select>
                                                    {/if}
                                                </div>
                                                <div class="layui-timeline-content layui-text">
                                                    <button type="button" class="unifydelbut deletePoi">删除</button>
                                                </div>
                                            </div>
                                            <p class="distance-list">
                                                <span class="distance-list-car">{if isset($active.limit) && $active.limit>0}<i class="layui-icon">&#xe715;</i>相距{$active.limit}公里{/if}</span>
                                            </p>
                                        </div>
                                        {/volist}
                                        {/notempty}
                                    </div>
                                    <div class="layui-form-item layui-form-text" style="margin-top:10px;">
                                        <span class="addclassify unifybutadd" data-day="{$vo.dayNum}"> <i class="layui-icon" style="font-size: 30px">&#xe654;</i></span>
                                    </div>
                                </div>
                            </li>
                            {/volist}
                            {/notempty}
                            <!--第二层景点时间轴-->
                            <li class="layui-timeline-item addnumber" style="line-height: 32px;margin-bottom: 50px">
                           <span class="addnumber addnumsty" id="addnumber" style="line-height: 32px">
                                <i class="layui-icon" style="font-size: 30px">&#xe654;</i>
                           </span>
                            </li>
                        </ul>
                    </form>
                </div>
                <!--右侧数据-->
                <div style="width: 50%;height: 580px;overflow: auto; border-left: 1px solid #CCCCCC;padding-left: 10px;z-index: 2" >
                    <div id="poiDataInfo">
                        <div id="show_rightmap" class="border-d2 hidden">
                            <p style="font-weight: bold">
                                展示地图：
                                <span id="totle_duration" style="margin-left:100px;"></span>
                                <span id="totle_total" style="margin-left:100px;"></span>
                                <span style="font-size: 12px;color:#999;">&nbsp;</span>
                                <i class="layui-icon layui-icon-close hideDayMapBtn">ဆ</i>
                            </p>
                            <div id="rightmap"></div>
                        </div>
                        <!--右侧poi详情-->
                        <div id="rightPoiInfo" class="border-d2 hidden" data-id="">
                        </div>
                        <!--右侧门票详情-->
                        <!--<div id="ticketInfo" class="border-d2 hidden" data-id=""></div>-->
                        <!--右侧修改poi详情-->
                        <div id="updPoiInfo" class="border-d2 hidden">
                            <p style="font-weight: bold" class="item-toggle-p" data-expanded="2">修改信息：<span style="font-size: 12px;color:#999;">&nbsp;</span><span class="item-toggle dragModule">展开</span></p>
                            <form id="updateActiveInfo" style="display:none;">
                                <input type="hidden" name="active_id" value="" autocomplete="off">
                                <div class="rightPoiInfo_item">
                                    <label>活动名称：</label>
                                    <span>
                                    <input name="active_name" readonly value="" placeholder="请输入" autocomplete="off" class="layui-input" type="text" lay-key="3" autocomplete="off">
                                </span>
                                </div>
                                <div class="rightPoiInfo_item" id="updpoi_title">
                                    <label>标题：</label>
                                    <span>
                                    <input name="title" value="" placeholder="请输入" autocomplete="off" class="layui-input" type="text" lay-key="3" autocomplete="off">
                                </span>
                                </div>
                                <div class="rightPoiInfo_item" id="updpoi_flight">
                                    <label>航班信息：</label>
                                    <span>
                                    <input name="flight" value="" placeholder="请输入" class="layui-input" type="text" lay-key="3" autocomplete="off">
                                </span>
                                </div>
                                <!--时间-->
                                <div class="rightPoiInfo_item">
                                    <label>时间：</label>
                                    <span>
                                    <input name="time" id="updpoi_time" value="" placeholder="请输入" autocomplete="off" class="layui-input" type="text" lay-key="3">
                                </span>
                                </div>
                                <!--特别说明-->
                                <div class="rightPoiInfo_item" id="updpoi_content">
                                    <label>备注：</label>
                                    <span style="width:525px;">
                                    <textarea placeholder="请输入内容" id="content" class="layui-textarea" name="content"></textarea>
                                </span>
                                </div>
                                <!--中文简介-->
                                <div class="rightPoiInfo_item" id="updpoi_poicontent">
                                    <label>中文简介：</label>
                                    <span style="width:525px;">
                                    <textarea placeholder="请输入内容" id="poi_content" class="layui-textarea" name="poi_content"></textarea>
                                </span>
                                </div>
                                <!--POI图片-->
                                <div class="rightPoiInfo_item" id="updpoi_img_btn">
                                    <label>图片库：</label>
                                    <span>
                                    <input type="hidden" id="poiImg" name="poiImg" value="" autocomplete="off">
                                    <a href="javascript:void(0);" class="layui-btn layui-btn-sm poiImg_btn" data-poiid="">
                                        打开
                                    </a>
                                </span>
                                </div>
                                <!--其他图片-->
                                <div class="rightPoiInfo_item" id="updother_img_btn">
                                    <label>上传图片：</label>
                                    <span>
                                    <input type="hidden" name="other_images" value="" autocomplete="off">
                                    <button type="button" class="layui-btn layui-btn-sm" id="otherimg_btn">上传</button><input class="layui-upload-file " type="file" name="file" autocomplete="off">
                                </span>
                                </div>
                                <div class="rightPoiInfo_item" id="show_updpoi_img">
                                    <label>预览图：</label>
                                    <span>
                                    <div class="layui-input-inline allImgArr" data-type="">
                                        <span id="poiImgShow"></span>
                                    </div>
                                </span>
                                </div>
                                <div class="rightPoiInfo_item" style="margin-top:10px;">
                                    <label>&nbsp;</label>
                                    <span class="rightPoiInfo_item_span">
                                    <a href="javascript:void(0);" class="rightPoiInfo_item_submit layui-btn updatePoiInfo_btn">
                                        保存
                                    </a>
                                </span>
                                </div>
                            </form>
                        </div>
                        <div id="rightNewPOI" class="border-d2 hidden">
                            <div class="layui-tab layui-tab-card" style="box-shadow: none">
                                <ul class="layui-tab-title">
                                    <li class="layui-this" id="newpoi_typename">景点</li>
                                </ul>
                                <div class="layui-tab-content">
                                    <div id="newpoimap" style="width:100%;height: 200px;margin-bottom:8px;">

                                    </div>
                                    <div class="layui-tab-item  layui-show">
                                        <form class="layui-form" id="newpoi" method="post">
                                            <div class="layui-form-item ourCity">
                                                <label class="layui-form-label">城市</label>
                                                <div class="layui-input-inline" style="position: relative">
                                                    <select name="groupid" lay-search="" autocomplete="off" lay-verify="required">
                                                        <option value="">请选择</option>
                                                        {volist name='ourcity' id='vo'}
                                                        <option value="{$vo.id}">{$vo.name}</option>
                                                        {/volist}
                                                    </select>
                                                </div>
                                            </div>
                                            <input type="hidden" name="typeid" id="newpoi_typeid" value="">

                                            <div class="layui-form-item">
                                                <label class="layui-form-label">名称</label>
                                                <div class="layui-input-inline" style="position: relative">
                                                    <input name="name" maxlength="500" id="poichname" value="" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                                                    <div class="addressbox"></div>

                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">英文名</label>
                                                <div class="layui-input-inline">
                                                    <input name="eng_name" maxlength="500" id="poienname" value=""  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                                                </div>
                                            </div>

                                            <div class="layui-form-item">
                                                <label class="layui-form-label">地址</label>
                                                <div class="layui-input-inline">
                                                    <input name="address" maxlength="50" id="newpoi_address"  value="{notempty name='$menu'}{$menu.address}{/notempty}" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                                                </div>
                                            </div>
                                            <input type="hidden" id="newpoi_lat" name="lat" value="" autocomplete="off">
                                            <input type="hidden" id="newpoi_lng" name="lng" value="" autocomplete="off">
                                            <input type="hidden" id="newpoi_place_id" name="place_id" value="" autocomplete="off">

                                            <!--中文简介-->
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">中文简介</label>
                                                <div class="layui-input-inline">
                                                    <textarea placeholder="请输入内容" id="newpoi_content" class="layui-textarea" name="introduce"></textarea>
                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">联系方式</label>
                                                <div class="layui-input-inline">
                                                    <textarea placeholder="请输入内容" class="layui-textarea" name="mobile"></textarea>

                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">来源</label>
                                                <div class="layui-input-inline">
                                                    <input name="source" maxlength="50" value=""  placeholder="请输入" autocomplete="off" class="layui-input" type="text">

                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">特别说明</label>
                                                <div class="layui-input-inline">
                                                    <textarea placeholder="请输入内容" class="layui-textarea" name="description"></textarea>
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="margin:0 110px ">
                                                <div class="layui-upload">
                                                    <button type="button" class="layui-btn" id="upload11">图片上传（格式：jpg,png,gif,jpeg）</button>
                                                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                                        预览图：
                                                        <div class="layui-upload-list" id="seeupload11">
                                                        </div>
                                                    </blockquote>
                                                </div>
                                                <input id="upload-thumb11" type="hidden" name="thumb" value="" autocomplete="off">
                                            </div>
                                            <div class="layui-form-item">
                                                <div class="layui-input-block">
                                                    <button type="button" class="layui-btn" lay-submit lay-filter="newpoi">立即提交</button>
                                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                                </div>
                                            </div>

                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="poi-detail poiinfo border-d2 hidden">

                        </div>
                    </div>
                    <style>
                        .transportlist{
                            width:100%;
                        }
                        .transport_item{
                            display: inline-block;
                            width: 45%;
                            margin: 8px;
                            font-size: 24px;
                            text-align: center;
                            border: 1px solid #dfdfdf;
                            line-height:80px ;
                            height: 80px;
                        }
                    </style>
                    <div id="dayDataInfo" hidden>
                        <p style="font-weight: bold" class="">交通类型：<i class="layui-icon layui-icon-close trans_type_close">ဆ</i></p>
                        <div class="transportlist">
                            {volist name='$transport' id='trans_v'}
                            <div class="transport_item" data-type="{$key}">
                                <p>{$trans_v}</p>
                            </div>
                            {/volist}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--右侧按钮-->
        <div class="ActionButton" hidden>
            <!--<div class="Actiondiv ManualSwitch" style="margin-bottom: 10px"><span class="ManualSwitch-span">核价显示</span></div>-->
            <div class="Actiondiv tripimport" style="margin-bottom: 10px" data-id="{$tripid}" >导入行程</div>
            <!--<div class="Actiondiv showDayMap {if isset($trip['show_day_map'])&&$trip['show_day_map']=='1'}hidden{/if}" style="margin-bottom: 10px">显示每日地图</div>-->
            <!--<div class="Actiondiv hideDayMap {if isset($trip['show_day_map'])&&$trip['show_day_map']=='0'}hidden{/if}" style="margin-bottom: 10px;background: #FF5722">隐藏每日地图</div>-->
            <!--<div class="Actiondiv showCityMap {if isset($trip['show_city_map'])&&$trip['show_city_map']=='1'}hidden{/if}" style="margin-bottom: 10px">显示城市地图</div>-->
            <!--<div class="Actiondiv hideCityMap {if isset($trip['show_city_map'])&&$trip['show_city_map']=='0'}hidden{/if}" style="margin-bottom: 10px;background: #FF5722">隐藏城市地图</div>-->
            <div class="Actiondiv tripconfig" data-id="{$tripid}" style="margin-bottom: 10px;">行程配置</div>
            <!--<div class="Actiondiv updateCityMap" style="margin-bottom: 10px">更新每日地图</div>-->

            <a href="{:url('admin/trip/partnerpreview',['id'=>$tripid])}" target="_blank" style="color: #fff">
                <div class="Actiondiv previewdiv" style="margin-bottom: 10px"><span>预览</span></div>
            </a>
            <div class="Actiondiv sortdiv" style="margin-bottom: 10px"><span>排序</span></div>
            {if isset($trip.is_template) && $trip.is_template==1}
            <div class="Actiondiv useTemplate" style="margin-bottom: 10px"><span>使用该模板</span></div>
            {/if}
            <!-- <a href="{:url('admin/quicktrip/index')}" style="color: #fff" >
                 <div class="Actiondiv"><span>返回列表</span></div>
             </a>-->
        </div>
        <div class="btnfix">
            <img src="/icon/active_btn.png" alt="">
        </div>
        <!--核价部分-->
        <div style="width: 100%;height: 1px;background: #efefef"></div>
        <div class="dragDownPricing "><span>行程方案&nbsp;&nbsp;&nbsp;&nbsp;</span><img src="/icon/down.png" width=25 height=25 alt=""></div>
        <div class="dragUpPricing"><span>核价信息&nbsp;&nbsp;&nbsp;&nbsp;</span><img src="/icon/up.gif" width=25 height=25 alt=""></div>
        <div class="box-price" id="box-price" hidden>
            <div class="layui-card-header" style="border: none;">核价信息
                <span style="font-size:12px;color:red;">（小技巧：按住shift键，滑动滚轮可以使表格左右滑动，查看更多内容）</span>
            </div>
            <div style="margin-left:5px;margin-bottom:10px;">
                <input id="exportExcel" type="button" value="导出Excel" class="layui-btn" />
                <input id="getOrderCarPrice" type="button" value="用车核价" class="layui-btn" />
                {if isset($trip.isPaid) && $trip.isPaid > 0}
                <input type="button" value="已支付" class="layui-btn layui-btn-normal" style="background: #5FB878" />
                {else}
                <input id="confirmOrder" type="button" value="确认完成定制" class="layui-btn layui-btn-normal" />
                {/if}
                {if isset($trip.isPaid) && isset($trip.admin_confirm) && $trip.admin_confirm > 0 && $trip.isPaid < 1}
                <input id="autoCreateOrder" type="button" value="生成订单" class="layui-btn layui-btn-normal" />
                {/if}

            </div>
            <table class="layui-table" style="min-width:170%;max-width:200%;margin-top:-1px;margin-bottom: 150px;" id="summaryPricingTable">
                <thead>
                <tr>
                    <th width="40px" rowspan="2">天数</th>
                    <th width="70px" rowspan="2">标题</th>
                    <th width="70px" rowspan="2">日期</th>
                    <th width="200px" rowspan="2">行程</th>
                    <th width="100px" rowspan="2">航班信息</th>
                    <th width="100px" rowspan="2">航班报价</th>
                    <th width="100px" rowspan="2">酒店信息</th>
                    <th width="100px" rowspan="2">酒店报价</th>
                    <th width="100px" rowspan="2">租车信息</th>
                    <th  style="width: 256px;text-align: center;" colspan="3">用车信息</th>
                    <th width="160px" rowspan="2">门票/活动项目信息</th>
                    <th width="80px" rowspan="2">门票/活动报价</th>
                    <th width="80px" rowspan="2">保险信息</th>
                    <th width="80px" rowspan="2">保险报价</th>
                    <th width="80px" rowspan="2">附加信息</th>
                    <th width="80px" rowspan="2">附加报价</th>
                </tr>
                <tr>
                    <th width="70px" style="text-align: center;">用车类型</th>
                    <th width="70px">总费用</th>
                    <th width="120px">费用说明</th>
                </tr>
                </thead>
                <tbody>
                {notempty name="$priceTable"}
                {volist name="priceTable" id="pric" key='pric_key'}
                <tr data-id="{$pric.id}">
                    <td rowspan="{$pric.trans_count}">{$pric.day}</td>
                    <td rowspan="{$pric.trans_count}">{$pric.title}</td>
                    <td rowspan="{$pric.trans_count}" >{$pric.time}</td>
                    <td rowspan="{$pric.trans_count}">{$pric.activeText}</td>
                    <td rowspan="{$pric.trans_count}">
                        {if !empty($pric.airport)}
                        {volist name="$pric.airport" id="airport"}
                        {$airport.typeText}：
                        {$airport.flight}<br style='mso-data-placement:same-cell;'/>
                        {/volist}
                        {/if}
                    </td>
                    <td rowspan="{$pric.trans_count}">
                        {if !empty($pric.airport)}
                        {volist name="$pric.airport" id="airport"}
                        <div class="airportDiv" style="margin-top:5px;">
                            <textarea data-id="{$airport.id}" placeholder="航班报价明细" name="airportDetail" autocomplete="off" class="layui-textarea table-input-text airportDetail">{notempty name='$airport.detail'}{$airport.detail}{/notempty}</textarea>
                            <span class="money-unit-symbol" style="margin-top:5px;margin-right:8px;">¥</span>
                            <input class="layui-input table-input airportPrice" name="airportPrice" data-id="{$airport.id}" placeholder="价格" autocomplete="off" value="{notempty name='$airport.price'}{$airport.price}{/notempty}" type="number">
                        </div>
                        {/volist}
                        {/if}
                    </td>
                    {if $pric.hotel_id>0}
                    {if $pric.hotel_show > 0}
                    <td rowspan="{$pric['hotel_td_num']}" class="hotel_td table-input" data-num="{$pric.hotel_num}" data-id="{$pric.hotel_id}">{$pric.hotel}</td>
                    <td rowspan="{$pric['hotel_td_num']}">
                        <input type="hidden" class="alldayhotel" value="{$pric.alldayhotel}">
                        <textarea placeholder="酒店明细" name="hotelDetail" class="layui-textarea table-input-text hotelDetail">{notempty name='$pric.tableData.hotelDetail'}{$pric.tableData.hotelDetail}{/notempty}</textarea>
                        <div class="hotel-dealis">
                            <span class="money-unit-symbol" style="margin-right:3px;">¥</span>
                            <input type="number" name="hotelPrice" data-num="{$pric.hotel_num}" class="layui-input inblock hotelPrice" placeholder="单价" autocomplete="off" style="width:50%;" value="{notempty name='$pric.tableData.hotelPrice'}{$pric.tableData.hotelPrice}{/notempty}">
                            *{$pric.hotel_num}天 =<br>
                            <span class="money-unit-symbol" style="margin-top:5px;margin-right:3px;">¥</span>
                            <input type="number" name="totalHotelPrice" class="layui-input inblock totalHotelPrice" placeholder="总价" autocomplete="off" style="width:60%;margin-top:5px;">
                        </div>
                    </td>
                    {/if}
                    {else}
                    <td rowspan="{$pric.trans_count}"></td>
                    <td rowspan="{$pric.trans_count}"></td>
                    {/if}


                    {if $pric.drive_num>0}
                    <td rowspan="{$pric.drive_td_num}" data-num="{$pric.drive_num}">
                        <input type="hidden" class="alldaydrive" value="{$pric.alldaydrive}">
                        <textarea placeholder="租车明细" name="driveDetail" class="layui-textarea table-input-text driveDetail">{notempty name='$pric.tableData.driveDetail'}{$pric.tableData.driveDetail}{/notempty}</textarea>
                        <div style="height:5px;"></div>
                        <span class="money-unit-symbol">¥</span>
                        <input type="number" name="drivePrice" data-num="{$pric.drive_num}" class="layui-input inblock drivePrice" placeholder="租车报价" autocomplete="off" style="width:70%;" value="{notempty name='$pric.tableData.drivePrice'}{$pric.tableData.drivePrice}{/notempty}">
                    </td>
                    {else}
                    {if $pric.drive_flag==0}
                    <td rowspan="{$pric.trans_count}"></td>
                    {/if}
                    {/if}


                    {notempty name='$pric.transport_pricing'}
                    {volist name='$pric.transport_pricing' id='t_value' key='t_key'}
                    {if $t_key<=1}
                    <td>{$t_value.displayString}
                        {if $t_value.displayString=='司导返程'}
                        <!--<span class="deleteReturnJourney" data-day="{$pric.id}"><i class="layui-icon layui-icon-close" style="color:red">ဆ</i></span>-->
                        {elseif $t_value.serviceType!='Transport_Vehicle_FromAirport' && !$t_value.hasReturn && count($pric['transport_pricing'])==$t_key}
                        <!--<br><br>-->
                        <!--<a data-day="{$pric.id}" class="setReturnJourney">设置司导返程</a>-->
                        {/if}</td>
                    <td>
                        <span class="money-unit-symbol">{if $t_value.currency=='CAD'}C${else}${/if}</span>
                        <div class="totalCarPrice">
                            {if isset($t_value['totalAmount'])}{$t_value.totalAmount}{/if}
                        </div>
                    </td>
                    <td>
                        {notempty name='$t_value.extra.overtimeFee'}超时费：{$t_value.extra.overtimeFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.hotelFee'}司导酒店费用：{$t_value.extra.hotelFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.dinnerFee'}餐补：{$t_value.extra.dinnerFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.oilFee'}油费：{$t_value.extra.oilFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.parkingFee'}停车费：{$t_value.extra.parkingFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.nightFee'}夜间服务费：{$t_value.extra.nightFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.assistanceFee'}陪护费用，导游费用：{$t_value.extra.assistanceFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.childSeatFee'}儿童座椅：{$t_value.extra.childSeatFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.exceedKMFee'}超出基础里程费用：{$t_value.extra.exceedKMFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.distance'}距离：{$t_value.distance/1000}km<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.duration'}时间：{$t_value.duration/3600|sprintf='%.2f',###}小时<br style='mso-data-placement:same-cell;'/> {/notempty}
                    </td>
                    {/if}
                    {/volist}
                    {/notempty}
                    {empty name='$pric.transport_pricing'}
                    <td></td>
                    <td></td>
                    <td></td>
                    {/empty}
                    <!--门票/活动项目信息-->
                    <td rowspan="{$pric.trans_count}" class="">
                        {empty name='$pric.tableData.ticketDetail'}
                        <div class="staff-not">/</div>
                        <textarea placeholder="门票/活动明细" name="ticketDetail" class="layui-textarea table-input-text staff-have ajaxSubmit ticketDetail"></textarea>
                        {/empty}
                        {notempty name='$pric.tableData.ticketDetail'}
                        <pre><textarea placeholder="门票/活动明细" name="ticketDetail" readonly class="layui-textarea table-input-text ajaxSubmit ticketDetail">{$pric.tableData.ticketDetail}</textarea></pre>
                        {/notempty}
                    </td>
                    <!--门票/活动报价-->
                    <td rowspan="{$pric.trans_count}" class="">
                        {empty name='$pric.tableData.ticketPrice'}
                        <div class="staff-not">/</div>
                        <span class="money-unit-symbol staff-have">¥</span><input type="number" name="ticketPrice" class="layui-input staff-have ajaxSubmit totalTicketPrice" readonly placeholder="门票" autocomplete="off" value="">
                        {/empty}
                        {notempty name='$pric.tableData.ticketPrice'}
                        <span class="money-unit-symbol">¥</span><input type="number" name="ticketPrice" class="layui-input ajaxSubmit totalTicketPrice" readonly placeholder="门票" autocomplete="off" value="{$pric.tableData.ticketPrice}">
                        {/notempty} </td>
                    <!--出境游保险-->
                    {if $pric_key==1}
                    <td rowspan="{$pric.total_td_num}" class="staff">
                        {empty name='$trip.insuranceDetail'}
                        <div class="staff-not">/</div>
                        <textarea placeholder="保险信息" name="insuranceDetail" class="layui-textarea table-input-text staff-have ajaxSubmit insuranceDetail"></textarea>
                        {/empty}
                        {notempty name='$trip.insuranceDetail'}
                        <textarea placeholder="保险信息" name="insuranceDetail" class="layui-textarea table-input-text ajaxSubmit insuranceDetail">{$trip.insuranceDetail}</textarea>
                        {/notempty}
                    </td>
                    <!--保险报价-->
                    <td rowspan="{$pric.total_td_num}" class="staff">
                        {empty name='$trip.insurancePrice'}
                        <div class="staff-not">/</div>
                        <span class="money-unit-symbol staff-have">¥</span>
                        <input type="number" name="insurancePrice" class="layui-input staff-have ajaxSubmit totalInsurancePrice" placeholder="保险报价" autocomplete="off" value="">
                        {/empty}
                        {notempty name='$trip.insurancePrice'}
                        <span class="money-unit-symbol">¥</span>
                        <input type="number" name="insurancePrice" class="layui-input ajaxSubmit totalInsurancePrice" placeholder="保险报价" autocomplete="off" value="{$trip.insurancePrice}">
                        {/notempty}
                    </td>
                    {/if}
                    <!--附加明细-->
                    <td rowspan="{$pric.trans_count}" class="staff">
                        {empty name='$pric.tableData.extraDetail'}
                        <div class="staff-not">/</div>
                        <textarea placeholder="附加信息" name="extraDetail" class="layui-textarea table-input-text staff-have ajaxSubmit extraDetail"></textarea>
                        {/empty}
                        {notempty name='$pric.tableData.extraDetail'}
                        <textarea placeholder="附加信息" name="extraDetail" class="layui-textarea table-input-text ajaxSubmit extraDetail">{$pric.tableData.extraDetail}</textarea>
                        {/notempty}
                    </td>
                    <!--附加费用-->
                    <td rowspan="{$pric.trans_count}" class="staff">
                        {empty name='$pric.tableData.extraPrice'}
                        <div class="staff-not">/</div>
                        <span class="money-unit-symbol staff-have">¥</span>
                        <input type="number" name="extraPrice" class="layui-input staff-have ajaxSubmit totalExtraPrice" placeholder="附加费" autocomplete="off" value="">
                        {/empty}
                        {notempty name='$pric.tableData.extraPrice'}
                        <span class="money-unit-symbol">¥</span>
                        <input type="number" name="extraPrice" class="layui-input ajaxSubmit totalExtraPrice" placeholder="附加费" autocomplete="off" value="{$pric.tableData.extraPrice}">
                        {/notempty}
                    </td>
                </tr>
                {notempty name='$pric.transport_pricing'}
                {volist name='$pric.transport_pricing' id='t_value' key='key'}
                {if $key>1}
                <tr>
                    <td>{$t_value.displayString}
                        {if $t_value.displayString=='司导返程'}
                        <!--<span class="deleteReturnJourney" data-day="{$pric.id}"><i class="layui-icon layui-icon-close" style="color:red">ဆ</i></span>-->
                        {elseif $t_value.serviceType!='Transport_Vehicle_FromAirport' && !$t_value.hasReturn && count($pric['transport_pricing'])==$key}
                        <!--<br><br>-->
                        <!--<a data-day="{$pric.id}" class="setReturnJourney">设置司导返程</a>-->
                        {/if}
                    </td>
                    <td>
                        <span class="money-unit-symbol">{if $t_value.currency=='CAD'}C${else}${/if}</span>
                        <div class="totalCarPrice">
                            {if isset($t_value.totalAmount)}{$t_value.totalAmount}{/if}
                        </div>
                    </td>
                    <td>
                        {notempty name='$t_value.extra.overtimeFee'}超时费：{$t_value.extra.overtimeFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.hotelFee'}司导酒店费用：{$t_value.extra.hotelFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.dinnerFee'}餐补：{$t_value.extra.dinnerFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.oilFee'}油费：{$t_value.extra.oilFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.parkingFee'}停车费：{$t_value.extra.parkingFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.nightFee'}夜间服务费：{$t_value.extra.nightFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.assistanceFee'}陪护费用，导游费用：{$t_value.extra.assistanceFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.childSeatFee'}儿童座椅：{$t_value.extra.childSeatFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.extra.exceedKMFee'}超出基础里程费用：{$t_value.extra.exceedKMFee}<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.distance'}距离：{$t_value.distance/1000}km<br style='mso-data-placement:same-cell;'/> {/notempty}
                        {notempty name='$t_value.duration'}时间：{$t_value.duration/3600|sprintf='%.2f',###}小时<br style='mso-data-placement:same-cell;'/> {/notempty}
                    </td>
                </tr>
                {/if}
                {/volist}
                {/notempty}
                {/volist}
                {/notempty}

                <tr style="text-align: center;background-color: #d4d4d4;">
                    <td></td>
                    <td colspan="3">成本总价</td>
                    <td></td>
                    <td>
                        航班报价
                        <button type="button" value="{$airportPrice_btn}" class="airportPrice_btn layui-btn layui-btn-xs hidden">自填</button>
                    </td>
                    <td></td>
                    <td>
                        酒店报价
                        <button type="button" value="{$hotelPrice_btn}" class="hotelPrice_btn layui-btn layui-btn-xs hidden">自填</button>
                    </td>
                    <td>
                        租车报价
                        <button type="button" value="{$drivePrice_btn}" class="drivePrice_btn layui-btn layui-btn-xs">自填</button>
                    </td>
                    <td></td>
                    <td>
                        <i id="defaultTips" onmouseover="showDefaultTips('defaultTips')"  class="layui-icon" style="margin-right: 4px;">&#xe702;</i>用车报价
                    </td>
                    <td>
                        <button type="button" value="{$carPrice_btn}" class="carPrice_btn layui-btn layui-btn-xs hidden">自填</button>
                    </td>
                    <td></td>
                    <td>门票/活动报价</td>
                    <td></td>
                    <td>保险报价</td>
                    <td></td>
                    <td>附加费用</td>
                </tr>
                <tr style="text-align: center">
                    <td>/</td>
                    <td colspan="3">
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="totalPrice" class="symbolPrice"></div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="airportPrice_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <input class="layui-input" name="airportPrice_ipt" autocomplete="off" value="{if isset($airportPrice_btn) && $airportPrice_btn>0}{$totalAirportPrice}{else}0{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                        <div class="airportPrice_count_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <div id="count_airportPrice" class="symbolPrice regionPrice">

                            </div>
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="hotelPrice_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <input class="layui-input" name="hotelPrice_ipt" autocomplete="off" value="{if isset($hotelPrice_btn) && $hotelPrice_btn>0}{totalHotelPrice}{else}0{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                        <div class="hotelPrice_count_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <div id="count_hotelPrice" class="symbolPrice regionPrice">

                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="drivePrice_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <input class="layui-input" name="drivePrice_ipt" autocomplete="off" value="{if isset($drivePrice_btn) && $drivePrice_btn>0}{$totalDrivePrice}{else}0{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                        <div class="drivePrice_count_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <div id="count_drivePrice" class="symbolPrice regionPrice">

                            </div>
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="carPrice_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <input class="layui-input" name="carPrice_ipt" autocomplete="off" value="{if isset($carPrice_btn) && $carPrice_btn>0}{$totalTransPrice}{else}0{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                        <div class="carPrice_count_ipt">
                            <span class="money-unit-symbol-Price">¥</span>
                            <div id="count_carPrice" class="symbolPrice regionPrice">

                            </div>
                        </div>
                    </td>
                    <td>/</td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_ticketPrice" class="symbolPrice regionPrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_insurancePrice" class="symbolPrice regionPrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_extraPrice" class="symbolPrice regionPrice">

                        </div>
                    </td>
                </tr>
                <tr style="text-align: center">
                    <td>/</td>
                    <td colspan="3">
                        <div class="symbolPrice">利率</div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="airportPrice_rate">
                            <input class="layui-input priceRate" name="totalAirportPrice_rate" autocomplete="off" value="{if isset($trip.totalAirportPrice_rate)}{$trip.totalAirportPrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="hotelPrice_rate">
                            <input class="layui-input priceRate" name="totalHotelPrice_rate" autocomplete="off" value="{if isset($trip.totalHotelPrice_rate)}{$trip.totalHotelPrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>
                        <div class="drivePrice_rate">
                            <input class="layui-input priceRate" name="totalDrivePrice_rate" autocomplete="off" value="{if isset($trip.totalDrivePrice_rate)}{$trip.totalDrivePrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="carPrice_rate">
                            <input class="layui-input priceRate" name="totalTransPrice_rate" autocomplete="off" value="{if isset($trip.totalTransPrice_rate)}{$trip.totalTransPrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>/</td>
                    <td>/</td>
                    <td>
                        <div class="ticketPrice_rate">
                            <input class="layui-input priceRate" name="totalTicketPrice_rate" autocomplete="off" value="{if isset($trip.totalTicketPrice_rate)}{$trip.totalTicketPrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="insurancePrice_rate">
                            <input class="layui-input priceRate" name="insurancePrice_rate" autocomplete="off" value="{if isset($trip.insurancePrice_rate)}{$trip.insurancePrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <div class="extraPrice_rate">
                            <input class="layui-input priceRate" name="totalExtraPrice_rate" autocomplete="off" value="{if isset($trip.totalExtraPrice_rate)}{$trip.totalExtraPrice_rate}{else}1{/if}" type="number" style="width:73%;display:inline;">
                        </div>
                    </td>
                </tr>
                <tr style="text-align: center;background-color: #d4d4d4;">
                    <td></td>
                    <td colspan="3">售价总价</td>
                    <td></td>
                    <td>
                        航班售价
                    </td>
                    <td></td>
                    <td>
                        酒店售价
                    </td>
                    <td>
                        租车售价
                    </td>
                    <td></td>
                    <td>
                        用车售价
                    </td>
                    <td></td>
                    <td></td>
                    <td>门票/活动售价</td>
                    <td></td>
                    <td>保险售价</td>
                    <td></td>
                    <td>附加费用</td>
                </tr>
                <tr style="text-align: center">
                    <td>/</td>
                    <td colspan="3">
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="totalSalePrice" class="symbolPrice"></div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_airportSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_hotelSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_driveSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_carSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_ticketSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_insuranceSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                    <td>/</td>
                    <td>
                        <span class="money-unit-symbol-Price">¥</span>
                        <div id="count_extraSalePrice" class="symbolPrice salePrice">

                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <!--遮罩-->
    <div class="box">
        <img src="/icon/shade-page.png" alt="">
    </div>
</div>

<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script src="__PUBLIC__/jquery/jquery.table2excel.js"></script>
<script src="__PUBLIC__/jquery/table2excel.min.js"></script>
<script>
    var currencyCodeList = {$currencyCodeList};
    var exchangeList = {$exchangeList};
    var poiClassifyList = {$poiClassifyList|json_encode};
    var global_active_type_arr = {$global_active_type_arr};
    var  is_show_shadow= {if isset($trip.is_show_shadow)}{$trip.is_show_shadow}{else}0{/if};
    //上边表单部分
    sessionStorage.setItem("expanded",'2');
    if(sessionStorage.getItem("isClose")=='true'){
        $("#customer").hide();
        $(".dragUp").hide();
        $(".dragDown").show();
    }else{
        $("#customer").show();
        $(".dragUp").show();
        $(".dragDown").hide();
    }
    //下边核价部分
    if(sessionStorage.getItem("isClosePricing")=='false' ||sessionStorage.getItem("isClosePricing")==undefined){
        $(".box-price").hide();  //核价板块
        $('.Travel-plan').show() //行程方案 板块
        $(".dragUpPricing").hide();
        $(".dragDownPricing").hide();
        // window.location.reload()
        $('.box-price').remove("switcherset"); //删除
        $('.ManualSwitch .ManualSwitch-span').text('核价显示');
    }else{
        $(".box-price").show(); //核价板块
        $('.Travel-plan').hide() //行程方案 板块
        $(".dragUpPricing").hide();
        $(".dragDownPricing").show();
        $('.box-price').addClass("switcherset"); //添加
        $('.ManualSwitch .ManualSwitch-span').text('核价隐藏');
    }
    //所有得input显示 为无 显示为 /

    $('.staff').click(function () {
        if($(this).children().eq(0).hasClass('staff-not')){
            $(this).children().eq(0).hide()
            $(this).children().eq(1).show()
            $(this).children().eq(2).show()
        }

    })

    /*自动撑开textarea*/
    function readyNumber() {

        $('textarea').each(function () {
            this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
        }).on('input', function () {
            this.style.height = 'auto';
            this.style.height = (this.scrollHeight) + 'px';
        })
    }

    readyNumber()
</script>
<script>
    //当前地图是否可见
    var visibleMap = false;
    layui.use(['layer', 'laydate', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form,
            laydate = layui.laydate;
        $("#getOrderCarPrice").click(function(){
            var id = $('#tripid').attr('value');
            //判断行程的车型是否选择
            var carType = {if isset($trip['carType']) && !empty($trip['carType'])}{$trip['carType']}{else}0{/if};
            if(carType==0 || carType=='' || carType==undefined){
                layer.msg('请选择车型并更新');
                return false;
            }
            var url="/admin/quicktrip/setsection/id/"+id+".shtml";
            layer.open({
                type:2,
                content:url,
                area: ['90%', '90%'],
                end:function(){
                    window.location.reload();
                }
            });
            return false;
        })
        $("#autoCreateOrder").click(function(){
            layer.confirm("确认该定制用户已支付？",function(){
                var loading = layer.load(1);
                setTimeout(function(){
                    var id = {$tripid};
                    if(id<1 || id==undefined){
                        layer.msg('请确认行程信息！');return false;
                    }
                    $.post("/admin/quicktrip/createPaidCustomMadeOrder",{id:id},function(data){
                        layer.close(loading);
                        layer.msg(data.msg);
                        if(data.code>0){
                            setTimeout(function(){
                                window.location.reload();
                            },1000)
                        }
                    },'json');
                },1000)
            })
        })
        $("#confirmOrder").click(function(){
            layer.confirm("确认该定制已完成？确认后用户可以支付",function(){
                var loading = layer.load(1);
                setTimeout(function(){
                    var id = {$tripid};
                    if(id<1 || id==undefined){
                        layer.msg('请确认行程信息！');return false;
                    }
                    $.post("/admin/quicktrip/adminConfirmOrderComplete",{id:id},function(data){
                        layer.close(loading);
                        layer.msg(data.msg);
                        if(data.code>0){
                            setTimeout(function(){
                                window.location.reload();
                            },1000)
                        }
                    },'json');
                },1000)
            })
        })
        laydate.render({     //创建时间选择框
            elem: '#start_go_time' //指定元素
            ,format: 'yyyy-MM-dd'
        });
        $('.poiImg_btn').click(function(){
            var id = $(this).attr('data-poiid');
            var url="/admin/trip/addpoiimg/id/"+id+".shtml&tob_type=1";
            layer.open({
                type:2,
                content:url,
                area: ['50%', '90%'],
                end:function(){
                    return false;
                }
            });

            return false;
        });
        $('.tripconfig').click(function(){
            var url = "/admin/quicktrip/tripconfig";
            var id = $(this).attr("data-id");
            layer.open({
                'type':2,
                'content':url+"?id="+id,
                'area':['50%','90%'],
                'end':function(){

                }
            })
        });

        //导入行程
        $('.tripimport').click(function(){
            var url = "/admin/quicktrip/tripimport";
            var id = $(this).attr("data-id");
            layer.open({
                'type':2,
                'content':url+"?id="+id,
                'area':['50%','90%'],
                'end':function(){
                    window.location.reload();
                }
            })
        });
        //弹窗的点击事件
        var i=$('#tripid').attr('value');
        if(i<=0){
            var url = "info";
            layer.open({
                type: 2,
                content: url,
                area: ['900px', '600px'],
                end: function () {
                    var tripid= $('#tripid').attr("value");
                    if(tripid>0){
                        location.href="/admin/quicktrip/tripmakepartner?id="+tripid;
                    }else{
                        {if $cookie['admin_cate_id']==28}
                        location.href="{$closeRedirectUrl}";
                        {else}
                        location.href="{:url('admin/quicktrip/index')}";
                        {/if}
                    }
                }
            });
        }

        //打开每日地图 右侧展示
        function rendderEveryMap(map){
            //关闭详情
            //$("#rightPoiInfo").hide();
            initMap("rightmap",map.start_poi,map.end_poi,map.middle_poi)
            if(!checkMapResult("rightmap")){
                $("#show_rightmap").show();
                layer.msg("规划路线失败");
            }else{
                visibleMap = true;
            }
        }

        $(".getDayMap").click(function(){
            var id = $(this).attr('data-id');
            getEveryDayMapPoint(id);
        });

        $(".hideDayMapBtn").click(function(){
            visibleMap = false;
            $("#show_rightmap").hide();
            // hideRightMap()
        });

        function getEveryDayMapPoint(id){
            $.get("/admin/quicktrip/getDayMap?ajax=1&id="+id,{},function(data){
                if(data.code==200){
                    $("#show_rightmap").show();
                    var hasLine = data.data.hasLine;
                    var mappoints = data.data.map;
                    if(hasLine){
                        rendderEveryMap(mappoints)
                    }else{
                        notGetMapInfo()
                    }
                }
            },"json")
        }

        function notGetMapInfo(){
            hideRightMap();
            $("#rightmap").children().remove();
            $("#show_rightmap").show();
            layer.msg('路线规划失败');
        }

        function hideRightMap(){
            //关闭详情
            //$("#show_rightmap").hide();
        }

        //新增POI
        $('body').on('click','.addclassify',function () {
            var schedule_id = $(this).parent().parent().parent().find(".schedule_id").attr("value");
            var active_id = 0;
            var addbtn = $(this);
            var a_div = addbtn.parent().parent().find(".a_div:last");
            var precityid = a_div.find(".city_slt").val();
            var anchor = addbtn.parent().parent().parent().attr("id");
            var activeType = a_div.find(".activeType").attr("value");

            sessionStorage.setItem("tripmake_anchor",anchor);
            $.ajax({
                url:"{:url('addActive')}",
                type:'post',
                data:{schedule_id:schedule_id,cityid:precityid,activeType:activeType},
                success:function(res) {
                    if(res.code==1){
                        active_id = res.data;
                        var html = a_div.find(".messdiv").html();
                        //添加poi的距离
                        var p_html = a_div.find(".distance-list").html();
                        var p_html = "<p class='distance-list'>"+p_html+"</p>";

                        if(html=='' || html==null){
                            location.reload();
                            return false;
                        }

                        html = "<div class='a_div' id='"+active_id+"_aid'><div class='layui-form-item messdiv'><div id='addActive_flag_"+active_id+"'></div>"+html;
                        html = html  + '</div>' + p_html;
                        addbtn.parent().prev().append(html);
                        addbtn.parent().prev().find("#"+active_id+"_aid .active_id").val(active_id);
                        if(activeType==6){
                            addbtn.parent().prev().find("#"+active_id+"_aid .selectpoilist input[name=other]").attr('data-id',active_id);
                        }

                        $("#addActive_flag_"+active_id).next(".active_id").attr("value",active_id);
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").attr("name","city_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").find('option:selected').removeAttr("selected");
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").val(precityid);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").attr("name","activeSelect_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").attr("id","activeSelect_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").attr("data-id",active_id);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").find('option:selected').removeAttr("selected");
                        $("#addActive_flag_"+active_id).remove();
                        form.render('select');

                        console.log(precityid);

                        poiInvertSelect();

                        //重置节点前后距离
                        getPointDistace(active_id,schedule_id);

                        allSortKeyNum();
                    }else{
                        layer.msg(res.msg);
                        return false;
                    }
                }
            });
        });

        //新增天数
        $('#addnumber').bind('click',function () {
            var tripid=$('#tripid').attr("value");
            var that=$(this);
            $.ajax({
                url:"{:url('addDay')}",
                type:'post',
                data:{tripid:tripid},
                success:function(res) {
                    if(res.code==1){
                        var anchor = $(that).parent().prev().find(".schedule_id").val();
                        sessionStorage.setItem("tripmake_anchor","li_"+anchor);
                        location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });

        //计算日期
        function getNewDay(dateTemp, days) {
            var dateTemp = dateTemp.split("-");
            //转换为MM-DD-YYYY格式
            if(days<1){
                var days=0
            }else{
                var days=days-1
            }
            var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
            var millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000);
            var rDate = new Date(millSeconds);
            var year = rDate.getFullYear();
            var month = rDate.getMonth() + 1;
            if (month < 10) month = "0" + month;
            var date = rDate.getDate();
            if (date < 10) date = "0" + date;
            return (year + "-" + month + "-" + date);
        }
        //获取出行日期的input的值
        var statime=$('#start_go_time').val()
        var statday=$('#days').val()
        //结束日期赋值
        $('#end_go_time').val(getNewDay(statime,statday))

        //选择城市
        form.on('select(city)', function(param){
            var city_id = param.value;
            if(city_id=="" || city_id==undefined){
                return false;
            }
            var select = $(this).parent().parent().parent().find(".city_slt");
            var name = select.attr("name");
            var numArr = name.split("_");
            var active_id = numArr[1];
            var type_id = select.parent().parent().find(".activeType").attr("value");

            setActiveSelect(type_id,city_id,active_id);

            //重置节点前后距离
            var schedule_id = select.parent().parent().parent().parent().find(".schedule_id").attr("value");
            getPointDistace(active_id,schedule_id);
        });

        function getActiveTypeName(type_id)
        {
            var typename="";
            type_id = parseInt(type_id);
            $.each(poiClassifyList,function(i,v){
                if(type_id==v.id){
                    typename = v.name;
                    return false;
                }
            })
            return typename;
        }
        //渲染activeSelect选择框
        function setActiveSelect(type_id,city_id,active_id){
            var typename = '';
            switch(type_id){
                case 1://POI
                    typename = '请选择POI';
                    break;
                case 2://接机
                    typename = '请选择机场';
                    break;
                case 3://送机
                    typename = '请选择机场';
                    break;
                case 4://酒店
                    typename = '请选择酒店';
                    break;
                case 5://特色体验
                    typename = '特色体验';
                    break;
                case 6://其他
                    typename = '其他';
                    break;
            }
            var html = '';
            if(city_id>0){
                $.ajax({
                    url:"{:url('admin/quicktrip/getActiveData')}",
                    data:{type_id:type_id,active_id:active_id,city_id:city_id},
                    type:'post',
                    async: false,
                    success:function(data) {
                        if(data.code<1){
                            layer.msg(data.msg);
                            return false;
                        }
                        html += "<option value=''>"+typename+"</option>";
                        for(var i=0;i<data.length;i++){
                            html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                        }
                    }
                });
            }

            $("#activeSelect_"+active_id).html(html);
            //重新渲染select
            form.render('select');
            poiInvertSelect();
        }

        //选中active
        form.on('select(activeSelect)', function(param){
            var item_id = param.value;
            if( item_id=="" || item_id==undefined ){
                return false;
            }

            var item_text = $(this).text();
            var active_id = $(this).parent().parent().parent().parent().find(".active_id").attr("value");
            var citySelect = $(this).parent().parent().parent().parent().find(".city_slt");
            var type_id = citySelect.parent().parent().find(".activeType").attr("value");//类型id
            var dayNum = $(this).parent().parent().prev().attr("data-day");
            var schedule_id = $(this).parent().parent().prev().attr("data-sid");
            var city_id = citySelect.val();
            var groupid = 0;
            var typeid = 0;
            var setactive_load = layer.load(2);
            $.ajax({
                url:"{:url('admin/quicktrip/setActive')}",
                data:{active_id:active_id,item_id:item_id,type_id:type_id,item_text:item_text},
                type:'post',
                async: false,
                success:function(res) {
                    layer.close(setactive_load);
                    if(res.code < 1){
                        layer.msg(res.msg);
                        return false;
                    }
                    groupid = res.data.groupid;
                    typeid = res.data.typeid;
                    //重置节点前后距离
                    getPointDistace(active_id,schedule_id);

                    //更新侧边栏
                    getRecommendList(item_id,dayNum,schedule_id,type_id,active_id,item_text);

                    if(groupid!=='' && parseInt(groupid)!==parseInt(city_id)){
                        citySelect.val(groupid);
                        $.post("{:url('admin/quicktrip/getpoiByInput')}",{city_id:groupid},function(data){
                            var html="<option value=''>POI</option>";
                            for(var i=0;i<data.length;i++){
                                html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                            }

                            $("#activeSelect_"+active_id).html(html);
                            $("#activeSelect_"+active_id).val(item_id);

                            //重新渲染select
                            form.render('select');

                            poiInvertSelect();
                        },"Json");
                    }

                    //重新获取节点的分类
                    console.log(typeid,type_id,getActiveTypeName(typeid));
                    if(typeid!=='' && parseInt(typeid)!==parseInt(type_id)){
                        citySelect.parent().parent().find(".activeType").attr("value",typeid);
                        citySelect.parent().parent().find(".activeType").next().children().text(getActiveTypeName(typeid));
                    }
                }
            });
        });

        //填写title
        $('body').on('blur','.schedule_title',function (){
            var title = $(this).val();
            var schedule_id = $(this).parent().parent().parent().find(".schedule_id").attr("value");
            if(title==''){
                return false;
            }
            $.post("{:url('admin/quicktrip/changeTitle')}",{title:title,schedule_id:schedule_id},function(res){
                if(res.code==1){

                }else{
                    layer.msg(res.msg);
                }
            },"Json");
            return false;
        });

        //删除节点
        $('body').on('click','.deletePoi',function () {
            var active_id = $(this).parent().parent().find(".active_id").attr("value");
            var schedule_id = $(this).parent().parent().parent().parent().parent().parent().find(".schedule_id").attr("value");
            var that = $(this);
            var prev_activeId = $(this).parent().parent().parent().prev().prev(".a_div").find(".active_id").attr("value");
            var next_activeId = $(this).parent().parent().parent().next().next(".a_div").find(".active_id").attr("value");

            layer.confirm('确定要删除吗?', function() {
                var loading = layer.load(2, {
                    shade: false
                });

                $.ajax({
                    url:"{:url('deletePoi')}",
                    type:'post',
                    data:{active_id:active_id},
                    success:function(res) {
                        layer.close(loading);
                        if(res.code==1){
                            layer.msg(res.msg);
                            that.parent().parent().parent().remove();
                            resetRightModuleData();
                            //重置节点前后距离
                            if(prev_activeId!==null && prev_activeId>0){
                                getPointDistace(prev_activeId,schedule_id);
                            }else{
                                if(next_activeId!==null && next_activeId>0){
                                    getPointDistace(next_activeId,schedule_id);
                                }
                            }

                            allSortKeyNum();

                            if(visibleMap){
                                //重新渲染地图
                                getEveryDayMapPoint(schedule_id);
                                return false;
                            }
                        }else{
                            layer.msg(res.msg);
                            return false;
                        }
                    }
                });
            });
            return false;
        });

        function resetRightModuleData(){
            $("#updPoiInfo").hide();
            $("#rightPoiInfo").hide();
            $("#ticketInfo").hide();
            $("#rightNewPOI").hide();
            $(".poiinfo").hide();
        }

        //删除Day
        $('body').on('click','.deleteDay',function () {
            var schedule_id = $(this).parent().parent().find(".schedule_id").attr("value");
            var that = this;
            layer.confirm('确定要删除吗?', function() {
                var loading = layer.load(2, {
                    shade: false
                });
                $.ajax({
                    url:"{:url('deleteDay')}",
                    type:'post',
                    data:{schedule_id:schedule_id},
                    success:function(res) {
                        layer.close(loading);
                        if(res.code==1){
                            layer.msg(res.msg);
                            var anchor = $(that).parent().parent().prev().find(".schedule_id").val();
                            console.log()
                            sessionStorage.setItem("tripmake_anchor","li_"+anchor);
                            location.reload();
                            return false;
                        }else{
                            layer.msg(res.msg);
                            return false;
                        }
                    }
                });
            });

            return false;
        });

        //点击打开排序sortdiv
        $('.sortdiv').click(function () {
            var url = "/admin/quicktrip/dragsort";
            var tripid=$('#tripid').attr('value');
            layer.open({
                title:'排序',
                type: 2,
                content: url+'?id='+tripid,
                area: ['96%', '90%'],
                end: function () {
                    location.reload();
                }
            });
            return false;
        });
        //使用该模板
        $('.useTemplate').click(function () {
            layer.confirm("是否将当前模板转成定制？",function(){
                var loading = layer.load(1);
                setTimeout(function(){
                    var tripid=$('#tripid').attr('value');
                    if(tripid<1 || tripid==undefined){
                        layer.close(loading);
                        layer.msg('当前模板信息有误！');
                        return false;
                    }
                    $.post("/admin/quicktrip/createTripByTemplate",{temp_id:tripid},function(data){
                        layer.close(loading);
                        layer.msg(data.msg);
                        if(data.code>0){
                            setTimeout(function(){
                                window.location.href="/admin/quicktrip/tripmakepartner?id="+data.data.id;
                            },1000)
                        }
                    },'json');
                },500)
            })
        });
        //更新行程城市地图
        $(".updateCityMap").click(function(){
            var tripid = $("input[name=tripid]").val();
            if(tripid=="" || tripid==undefined){
                layer.msg("请先添加行程信息");
                return false;
            }
            var update_city_map = layer.load(1);
            $.post("/admin/quicktrip/updateEveryDayPOIMapImg",{'trip_id':tripid},function(data){
                layer.close(update_city_map);
                layer.msg(data.msg);
            },"json")
        });

        //显示每日地图
        $(".showDayMap").click(function(){
            changeDayMapShow(1);
        });

        //隐藏每日地图
        $(".hideDayMap").click(function(){
            changeDayMapShow(0)
        });

        //显示城市地图
        $(".showCityMap").click(function(){
            changeCityMapShow(1);
        });

        //隐藏每日地图
        $(".hideCityMap").click(function(){
            changeCityMapShow(0)
        });

        //更新信息
        form.on('submit(customer)', function(data) {
            var name=$('#name').val();
            var days=$('#days').val();
            var start_go_time=$('#start_go_time').val();
            if(name !=='' && days !==''&& start_go_time !==''){
                $.ajax({
                    url:"{:url('/admin/quicktrip/changeInfo')}",
                    data:$('#customer').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code>0){
                            //结束日期赋值
                            $('#end_go_time').val(getNewDay(start_go_time,days));
                            location.reload();
                        }
                        return false;
                    }
                })
            }else{
                layer.msg('关键信息不能为空！')
            }
            return false;
        });

        function changeDayMapShow(show){
            var tripid = $("input[name=tripid]").val();
            if(tripid=="" || tripid==undefined){
                layer.msg("请先添加行程信息");
                return false;
            }
            var day_map_show = layer.load(1);
            $.post("/admin/quicktrip/changeShowScheduleMapImg",{'trip_id':tripid,'is_show':show},function(data){
                layer.close(day_map_show);
                if(data.code==200){
                    if(show==0){
                        $(".showDayMap").show();
                        $(".hideDayMap").hide();
                        layer.msg("已隐藏每日地图");
                    }else{
                        $(".showDayMap").hide();
                        $(".hideDayMap").show();
                        layer.msg("已显示每日地图");
                    }
                }else{
                    layer.msg(data.msg);
                }
            },"json")
        }

        function changeCityMapShow(show){
            var tripid = $("input[name=tripid]").val();
            if(tripid=="" || tripid==undefined){
                layer.msg("请先添加行程信息");
                return false;
            }
            var day_map_show = layer.load(1);
            $.post("/admin/quicktrip/changeShowCityMapImg",{'trip_id':tripid,'is_show':show},function(data){
                layer.close(day_map_show);
                if(data.code==200){
                    if(show==0){
                        $(".showCityMap").show();
                        $(".hideCityMap").hide();
                        layer.msg("已隐藏城市地图");
                    }else{
                        $(".showCityMap").hide();
                        $(".hideCityMap").show();
                        layer.msg("已显示城市地图");
                    }
                }else{
                    layer.msg(data.msg);
                }
            },"json")
        }

        //获取推荐列表案例
        $('body').on('click',".selectpoilist input",selectPoi3);

        function selectPoi3(e) {
            changRightShowDataType();
            //添加颜色  $('.messdiv')
            var shadow= $(this);
            $('.activeinput').removeClass("activeinput");
            $(shadow).addClass("activeinput");
            hideRightMap();
            var input = $(this).val();
            if(input=="" || input==undefined){
                return false;
            }
            var type_id = $(this).attr("data-type");
            var dayNum = schedule_id = input_poIid = active_id = 0;
            if(type_id=='6'){
                var hidden_active= $(this).parent().parent();
                dayNum = hidden_active.find(".active_id").attr('data-day')
                schedule_id = hidden_active.find(".active_id").attr('data-sid')
                active_id = hidden_active.find(".active_id").attr('value');
                //赋值setTitle
                $.post("/admin/quicktrip/updateActiveInfo",{active_id:active_id,title:input,activeType:type_id},function(res){},'json')
                //隐藏poi详情 地图
                $("#rightPoiInfo").hide();
                $("#ticketInfo").hide();
                $("#show_rightmap").hide();
            }else{
                //取消名字不显示
                // shadow.val('');
                shadow.select();
                var select_poi = $(this).parent().parent();
                input_poIid= select_poi.prev().find('option:selected').val()
                dayNum = select_poi.parent().find("select").attr('data-day')
                schedule_id= select_poi.parent().find("select").attr('data-sid')
                active_id = select_poi.parent().parent().find(".active_id").val();
                type_id = $(this).parent().parent().parent().parent().find(".activeType").attr("value");
                //隐藏poi详情 地图
                $("#rightPoiInfo").show();
                $("#ticketInfo").show();
                if(visibleMap){
                    $("#show_rightmap").show();
                }
            }
            getRecommendList(input_poIid,dayNum,schedule_id,type_id,active_id,input)

        }

        //渲染右侧数据
        function renderRightPoiData(data,dayNum,schedule_id,active_type_id,self){
            //开始渲染
            var htmldiv=''
            $('.poi-detail').children().remove()
            htmldiv+='<p style="font-weight: bold" class="item-toggle-p" data-expanded="3">附近POI：<span style="font-size: 12px;color:#999;">(tips:点击左侧poi,然后点击小图执行添加,附近POI会添加到当天行程的最后)</span><span class="item-toggle dragModule">收起</span></p>\n'
            htmldiv+='<div class="nearbyPoiList">';
            htmldiv+='<div id="nearbyPoiMap"></div>\n';
            for(var i=0;i<data.length;i++){
                htmldiv+='  <div class="poi-detail-item" data-cid="'+data[i].cityId+'" data-pid="'+data[i].id+'" data-day="'+dayNum+'" data-sid="'+schedule_id+'" data-tid="'+active_type_id+'">\n' +
                    '                        <div class="poi-detail-item-imgbox">\n' ;
                if(+data[i].name.length>8){
                    htmldiv+='<p class="poi-detail-item-title1">'+data[i].name+'</p>\n';
                }else{
                    htmldiv+='<p class="poi-detail-item-title">'+data[i].name+'</p>\n';
                }

                htmldiv+= '</div>\n' +
                    '                        <div class="poi-p-list-box">\n' +
                    '                        <p>'+data[i].eng_name+'</p>\n' +
                    '                        <p>'+data[i].distance+'km</p>\n' +
                    '                        </div>\n'+
                    '                    </div>'
            }
            htmldiv+='</div>';
            $('.poi-detail').append(htmldiv)
            if(sessionStorage.getItem("expanded")=='3'){
                $(".nearbyPoiList").slideDown(250);
                $(".nearbyPoiList").prev().find(".dragModule").html("收起");
            }else{
                $(".nearbyPoiList").slideUp(250);
                $(".nearbyPoiList").prev().find(".dragModule").html("展开");
            }

            //渲染附近景点地图
            if(data.length>0 && self!==null){
                map_name = "nearbyPoiMap";
                var selfPoi = {};
                selfPoi.lat = parseFloat(self.lat);
                selfPoi.lng = parseFloat(self.lng);
                initMapPoint(map_name,selfPoi,data,selfPoi)
            }

            //如果地图显示状态刷新地图
            if(visibleMap){
                //模拟点击显示地图
                $("#li_"+schedule_id).find(".getDayMap").click();
            }
        }

        function getRecommendList(poiid,dayNum,schedule_id,active_type_id,active_id,active_name){
            //开启更新信息
            showUpdPoiInfo(active_id,active_type_id,active_name);
            if($.inArray(parseInt(active_type_id),global_active_type_arr)>-1){
                //poi与酒店
                //获取poi详情
                var self = getPOIInfo(poiid,active_id);
                $(".poiinfo").show();
                if(active_type_id==1){
                    $.post("/admin/quicktrip/getRecommendPoiList",{poi_id:poiid},function(data){
                        renderRightPoiData(data.data,dayNum,schedule_id,active_type_id,self)
                    },'json')
                    //     获取上一次得点击值
                    console.log(sessionStorage.getItem('expanded'))
                    if(sessionStorage.getItem('expanded')=='2'){
                        $("#updateActiveInfo").slideDown(250);
                        $("#updateActiveInfo").prev().find(".dragModule").html("收起");
                    }else{
                        $("#updateActiveInfo").slideUp(250);
                        $("#updateActiveInfo").prev().find(".dragModule").html("展开");
                    }
                }else{
                    $(".poiinfo").hide();
                }
            }else{
                //$("#rightPoiInfo").hide();
                $(".poiinfo").hide();
                $("#ticketInfo").hide();
                $("#updateActiveInfo").slideDown(250);
                $("#updateActiveInfo").prev().find(".dragModule").html("收起");
            }
        }

        function showUpdPoiInfo(active_id,active_type_id,active_name)
        {
            $("#updPoiInfo").show();
            resetUpdPoiInfo();
            //获取新的active数据
            $.post("/admin/quicktrip/getActiveInfo",{active_id:active_id},function(res){
                if(res.code==200) {
                    var typename = getActiveTypeName(parseInt(active_type_id));
                    $("#updateActiveInfo input[name=active_name]").val(typename+"---"+active_name);
                    if ($.inArray(parseInt(active_type_id),global_active_type_arr) > -1) {
                        $("#updother_img_btn").hide();
                        $("#updpoi_img_btn").show();
                        $("#show_updpoi_img").show();
                        $("#updpoi_title").hide();
                        $("#updpoi_poicontent").show();
                        $("#updpoi_flight").hide();
                    } else if($.inArray(active_type_id, ['6']) > -1){
                        $("#updpoi_img_btn").hide();
                        $("#updother_img_btn").show();
                        $("#updpoi_title").show();
                        $("#updpoi_poicontent").hide();
                        $("#show_updpoi_img").show();
                        $("#updpoi_flight").hide();
                    }else if($.inArray(active_type_id, ['2','3']) > -1){
                        $("#updpoi_poicontent").hide();
                        $("#updpoi_img_btn").hide();
                        $("#updother_img_btn").hide();
                        $("#updpoi_title").hide();
                        $("#show_updpoi_img").hide();
                        //显示航班信息
                        $("#updpoi_flight").show();
                    }else{
                        $("#updpoi_poicontent").hide();
                        $("#updpoi_img_btn").hide();
                        $("#updother_img_btn").hide();
                        $("#updpoi_title").hide();
                        $("#show_updpoi_img").hide();
                        $("#updpoi_flight").hide();
                    }
                    var data = res.data;
                    $(".poiImg_btn").attr("data-poiid",data.poiid);
                    $("#updateActiveInfo input[name=active_id]").val(data.id);
                    $("#updateActiveInfo input[name=title]").val(data.title);
                    if(data.time==0){
                        data.time = '';
                    }
                    $("#updateActiveInfo input[name=time]").val(data.time);
                    // $("#updateActiveInfo textarea[name=content]").val(data.content);
                    if(data.content!==null){
                    ue1.setContent(data.content);
                    }
                    //机场的详情不赋值
                    if(data.poi_content!==null && $.inArray(parseInt(active_type_id), global_active_type_arr) > -1){
                        ue.setContent(data.poi_content);
                    }
                    $("#updateActiveInfo .allImgArr").attr('data-type',active_type_id);
                    $("#updateActiveInfo input[name=flight]").val(data.flight);
                    $("#updateActiveInfo input[name=poiImg]").val(data.poiImg);
                    $("#updateActiveInfo input[name=other_images]").val(data.other_images);
                    var imghtml = "";
                    if (data.poiImg_arr.length > 0 && $.inArray(parseInt(active_type_id),global_active_type_arr) > -1) {
                        $.each(data.poiImg_arr, function (i, v) {
                            imghtml += '<div style="display:inline-block">' +
                                '<img class="layui-upload-img" src="' + v + '" style="width:85px;padding:5px;">' +
                                '<i class="layui-icon">&#x1006;</i>' +
                                '</div>';
                        });
                        $("#poiImgShow").children().remove();
                        $("#poiImgShow").append(imghtml);
                    }
                    if (data.other_images_arr.length > 0 && $.inArray(active_type_id, ['6']) > -1) {
                        $.each(data.other_images_arr, function (i, v) {
                            imghtml += '<div style="display:inline-block">' +
                                '<img class="layui-upload-img" src="' + v + '" style="width:85px;padding:5px;">' +
                                '<i class="layui-icon">&#x1006;</i>' +
                                '</div>';
                        })
                        $("#poiImgShow").children().remove();
                        $("#poiImgShow").append(imghtml);
                    }

                }else{
                    layer.msg(res.msg);
                }
            },'json')
        }

        function resetUpdPoiInfo()
        {
            $("#updateActiveInfo input[name=active_id]").val(0);
            $("#updateActiveInfo input[name=active_name]").val("");
            $("#updateActiveInfo input[name=title]").val("");
            $("#updateActiveInfo input[name=time]").val("");
            $("#updateActiveInfo textarea[name=content]").val("");
            $("#updateActiveInfo textarea[name=poi_content]").val("");
            $("#updateActiveInfo input[name=poiImg]").val("");
            $("#updateActiveInfo input[name=other_images]").val("");
            $("#updateActiveInfo input[name=flight]").val("");
            //富文本编辑器赋空
            ue.setContent("");
            ue1.setContent("");
            $("#poiImgShow").children().remove();
        }

        function getPOIInfo(poiid,active_id){
            $("#rightPoiInfo").show();
            var self = null;
            $.ajax({
                url:"/admin/poi/getPOIInfo",
                type:"POST",
                data:{id:poiid,active_id:active_id,table:'active'},
                dataType:"json",
                async:false,
                success:function(data) {
                    self = data.data;
                    $("#rightPoiInfo").children().remove();
                    var html = "";
                    html += '<p style="font-weight: bold" class="item-toggle-p" data-expanded="1">POI详情：<span style="font-size: 12px;color:#999;">&nbsp;</span><span class="item-toggle dragModule">展开</span></p>\n'
                    html += '<div style="display:none;" id="poiinfoitem">';
                    $.each(data.data, function (i, v) {
                        var showKey = ['ticket', 'address', 'description', 'mobile', 'open_time', 'source', 'ticket_cost', 'ticket_last_admin', 'ticket_last_updtime'];
                        var showKeyName = ['门票费用', '地址', '简介', '联系方式', '时间', '来源', '门票成本', '更新人', '更新于'];
                        //中文名称
                        if (i == 'name') {
                            html += '<p id="poi_name">' + v + '</p>';
                            //英文名
                        } else if (i == 'eng_name') {
                            html += '<p id="poi_engname">' + v + '</p>';
                            //详情
                        } else if (i == 'introduce' && $.trim(v) != "" && v != null) {
                            html += '<div class="rightPoiInfo_item">\n' +
                                '<label>详情：</label>\n' +
                                '<span><div id="poi_introduce">' + v + '</div></span>\n' +
                                '</div>';
                            //其他
                        } else if ($.inArray(i, showKey) != -1 && $.trim(v) != "" && v != null) {
                            var showname = showKeyName[$.inArray(i, showKey)];
                            html += '<div class="rightPoiInfo_item">\n' +
                                '<label>' + showname + '：</label>\n' +
                                '<span>' + v + '</span>\n' +
                                '</div>';
                        }
                    });
                    html += '</div>';
                    $("#rightPoiInfo").append(html);
                    //右侧门票详情
                    $("#ticketInfo").hide();
                    $("#ticketInfo").children().remove();
                    console.log(data);
                    if(data.activeType==1){
                        $("#ticketInfo").show();
                        //门票
                        var thtml="";
                        thtml+='<p style="font-weight: bold" class="item-toggle-p" data-expanded="1">门票详情：<span style="font-size: 12px;color:#999;">&nbsp;</span><span class="item-toggle dragModule">展开</span></p>\n'
                        thtml+='<div style="display:none;" id="ticketinfoitem">';
                        if(data.ticket_status==0){
                            thtml+='<button type="button" class="layui-btn layui-btn-danger layui-btn-sm ticketBtn" data-value="'+data.ticket_status+'" style="margin-left:10px;">未启用</button>';
                            //保存按钮
                            thtml+='<button type="button" class="layui-btn layui-btn-normal layui-btn-sm updTicketPeopleNum" style="margin-left:10px;display:none;">更新购买数量</button>';
                        }else{
                            thtml+='<button type="button" class="layui-btn layui-btn-sm ticketBtn" data-value="'+data.ticket_status+'" style="margin-left:10px;">启用中</button>';
                            //保存按钮
                            thtml+='<button type="button" class="layui-btn layui-btn-normal layui-btn-sm updTicketPeopleNum" style="margin-left:10px;">更新购买数量</button>';
                        }

                        $.each(data.data,function(i,v){
                            var showKey = ['ticket','ticket_cost','ticket_last_admin','ticket_last_updtime'];
                            var showKeyName = ['门票描述','门票成本','更新人','更新时间'];
                            if($.inArray(i,showKey)!=-1 && $.trim(v)!="" && v!=null){
                                var showname = showKeyName[$.inArray(i,showKey)];
                                thtml += '<div class="ticketInfo_item">\n' +
                                    '<label>'+showname+'：</label>\n' +
                                    '<span>'+v+'</span>\n' +
                                    '</div>';
                            }
                        });

                        if(data.ticket.length>0){
                            thtml += '<table class="layui-table" lay-even="" lay-skin="row" lay-size="sm">' +
                                '<colgroup>' +
                                '<col width="45%">' +
                                '<col width="15%">' +
                                '<col width="20%">' +
                                '<col width="20%">' +
                                '</colgroup>' +
                                '<thead>' +
                                '<tr>' +
                                '<th>门票名称</th>' +
                                '<th>数量</th>' +
                                '<th style="text-align: center;">建议销售价</th>' +
                                '<th style="text-align: center;">采购成本价</th>' +
                                '</tr>' +
                                '</thead>' +
                                '<tbody id="ticket_body">';

                            $.each(data.ticket,function(i,v){
                                var currency = '';
                                if(v.currency=='USD'){
                                    currency = "$";
                                }else{
                                    currency = "C$";
                                }

                                var sale_price = '';
                                if(v.sale_price!=='' && v.sale_price!==undefined && v.sale_price>=0){
                                    sale_price = currency+' '+v.sale_price;
                                }
                                var cost_price = '';
                                if(v.cost_price!=='' && v.cost_price!==undefined && v.cost_price>=0){
                                    cost_price = currency+' '+v.cost_price;
                                }
                                var ticket_num = 0;
                                if(data.ticket_json.length>0){
                                    $.each(data.ticket_json,function(ti,tv){
                                        if(parseInt(v.id)==parseInt(tv.ticket_id)){
                                            ticket_num = tv.number;
                                            return false;
                                        }
                                    })
                                }
                                thtml += '<tr class="ticket_tr">' +
                                    '<td><span>'+v.name+'</span></td>' +
                                    '<td><span class="layui-inline">x</span><input type="number" name="people_num" data-ticketid="'+v.id+'" style="width:50px;margin-left:5px;" class="layui-input layui-input-inline" value="'+ticket_num+'"></td>' +
                                    '<td style="text-align: center;">' +
                                    '<span>'+sale_price+'</span>' +
                                    '</td>' +
                                    '<td style="text-align: center;">' +
                                    '<span>'+cost_price+'</span>' +
                                    '</td>' +
                                    '</tr>';
                            });
                        }

                        thtml+='</div>';
                        $("#ticketInfo").append(thtml);
                    }

                    if (sessionStorage.getItem('expanded') == '1') {
                        $("#poiinfoitem").slideDown(250);
                        $("#poiinfoitem").prev().find(".dragModule").html("收起");
                    } else {
                        $("#poiinfoitem").slideUp(250);
                        $("#poiinfoitem").prev().find(".dragModule").html("展开");
                    }
                }
            })
            return self;
        }
        //从推荐poi加入行程
        $('body').on('click','.poi-detail-item',function () {
            var export_flag_index = layer.load(2);
            var _that = this;
            $(_that).addClass("disabled");
            var dayNum = $(this).attr("data-day");
            var cid = $(this).attr("data-cid");
            var pid = $(this).attr("data-pid");
            var tid = $(this).attr("data-tid");
            var schedule_id=$(this).attr("data-sid");
            //增加一行POI
            var addbtn =$(".addclassify[data-day='"+dayNum+"']");
            var click_active_id = $("#updPoiInfo").find("input[name='active_id']").attr("value");

            $.ajax({
                url:"{:url('addActive')}",
                type:'post',
                data:{schedule_id:schedule_id,cityid:cid},
                success:function(res) {
                    if(res.code==1){
                        var active_id = res.data;
                        var left_last_type_id = $("#"+click_active_id+"_aid").find(".activeType").attr("value");
                        var html = $("#"+click_active_id+"_aid").find(".messdiv").html();
                        //添加poi的距离
                        var p_html = $("#"+click_active_id+"_aid").find(".distance-list").html();
                        var p_html = "<p class='distance-list'>"+p_html+"</p>";

                        if(html=='' || html==null){
                            location.reload();
                            return false;
                        }

                        html = "<div class='a_div' id='"+active_id+"_aid'><div class='layui-form-item messdiv'><div id='addActive_flag_"+active_id+"'></div>"+html;
                        html = html  + '</div>' + p_html;
                        addbtn.parent().prev().append(html);
                        addbtn.parent().prev().find("#"+active_id+"_aid .active_id").val(active_id);

                        $("#addActive_flag_"+active_id).next(".active_id").attr("value",active_id);
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").attr("name","city_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").find('option:selected').removeAttr("selected");
                        $("#addActive_flag_"+active_id).parent().find(".city_slt").val(cid);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").attr("name","activeSelect_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").attr("id","activeSelect_"+active_id);
                        $("#addActive_flag_"+active_id).parent().find(".activeSelect_slt").find('option:selected').removeAttr("selected");
                        $("#addActive_flag_"+active_id).remove();
                        form.render('select');
                        //render poilist
                        $.post("{:url('admin/quicktrip/getActiveData')}",{active_id:active_id,city_id:cid,type_id:tid},function(data){
                            var html="<option value=''>POI</option>";
                            for(var i=0;i<data.length;i++){
                                html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                            }
                            if(left_last_type_id=='6'){
                                $("#"+active_id+"_aid").find(".selectpoilist").children().remove();
                                var select_html = '<select data-id="'+active_id+'" data-type="'+tid+'" name="activeSelect_'+active_id+'" lay-filter="activeSelect" lay-search class="activeSelect_slt" id="activeSelect_'+active_id+'" data-day="'+dayNum+'" data-sid="'+schedule_id+'"></select>';
                                $("#"+active_id+"_aid").find(".selectpoilist").append(select_html);
                            }
                            //重新渲染左侧类型和poi的select框
                            $("#"+active_id+"_aid").find(".activeType").attr("value",tid);
                            var typename = getActiveTypeName(parseInt(tid));
                            $("#"+active_id+"_aid").find(".detail-create span").html(typename);

                            $("#activeSelect_"+active_id).html(html);
                            $("#activeSelect_"+active_id).val(pid);
                            //重新渲染select
                            form.render('select');
                            //setpoi 推荐poi时保存导入的poi数据
                            $.ajax({
                                url:"{:url('admin/quicktrip/setpoi')}",
                                data:{active_id:active_id,poiid:pid},
                                type:'post',
                                async: false,
                                success:function(res) {
                                    groupid = res.data.groupid;
                                    if(visibleMap){
                                        //重新渲染地图
                                        getEveryDayMapPoint(schedule_id);
                                    }
                                    //重置节点前后距离
                                    getPointDistace(active_id,schedule_id);
                                }
                            });
                            poiInvertSelect();
                        },"Json");
                        setTimeout(function(){
                            layer.msg('添加成功',{time:500});
                            layer.close(export_flag_index);
                        },500);
                        $(_that).removeClass("disabled");

                        allSortKeyNum();
                    }else{
                        layer.close(export_flag_index);
                        layer.msg(res.msg);
                        return false;
                    }
                }
            });
        });
        //点击地图上的点 从推荐poi加入行程
        $('body').on('click','.mapPoi',function(){
            var poiid = $(this).attr('data-id');
            console.log(poiid);
            $(".poi-detail-item[data-pid="+poiid+"]").click();
        });
        function selectPoi2(e){
            changRightShowDataType();
            if (e.keyCode == 13) {
                var activeType = $(this).attr("data-type");
                var input = $(this).val();
                //其他
                if(activeType!==null && activeType==6){
                    hideRightMap();
                    if(input=="" || input==undefined){
                        return false;
                    }
                    var dayNum = schedule_id = input_poIid = active_id = 0;
                    var hidden_active = $(this).parent().parent();
                    dayNum = hidden_active.find(".active_id").attr('data-day')
                    schedule_id = hidden_active.find(".active_id").attr('data-sid')
                    active_id = hidden_active.find(".active_id").attr('value');
                    //赋值setTitle
                    $.post("/admin/quicktrip/updateActiveInfo", {active_id: active_id, title: input, activeType: activeType}, function (res) {
                        getRecommendList(input_poIid, dayNum, schedule_id, activeType, active_id,input)
                    }, 'json');
                }else{
                    var select = $(this).parent().parent().parent().find(".activeSelect_slt");
                    activeType = select.attr("data-type");
                    //非POI 酒店 美食 停车场 加油站 购物 租车
                    if($.inArray(parseInt(activeType),global_active_type_arr)==-1){
                        return false;
                    }

                    var name = select.attr("name");
                    var numArr = name.split("_");
                    var active_id = numArr[1];
                    var poiSelect = $("#activeSelect_"+active_id);

                    var citySelect = $(this).parent().parent().parent().parent().find(".city_slt");
                    var city_id = citySelect.val();
                    var poi_type = activeType;//poi类型
                    var poi_type_name = getActiveTypeName(poi_type);
                    console.log(poi_type,poi_type_name);

                    $.ajax({
                        url:"{:url('getpoiByInput')}",
                        type:'post',
                        data:{input:input,city_id:city_id},
                        success:function(data) {
                            //无数据提示新增poi
                            if(data.length<1 && input!="" && input!=undefined){
                                layer.msg('未检索到POI');

//                                //询问框
//                                var typeid = "";
//                                layer.confirm('未检索到POI,是否创建类型为“'+poi_type_name+'”的'+input+'？', {
//                                    btn: ['创建','取消'] //按钮
//                                }, function(){
                                      //render新增poi模块
                                      // 渲染newpoi地图
                                      //initialize_markerMap("newpoimap");
//                                    //隐藏其他子节点
//                                    $("#rightNewPOI").parent().children().hide();
//                                    $("#rightNewPOI").show();
//                                    $("#rightNewPOI").attr('active_id',active_id);
//                                    //添加新的poi
//                                    addNewPOi(poi_type,poi_type_name,input,city_id);
//                                    poiInvertSelect();
//                                    layer.msg('请在右侧添加数据');
//                                },function(){
//                                });
                            }else{
                                var html="<option value=''>请选择POI</option>";
                                for(var i=0;i<data.length;i++){
                                    html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                                }

                                poiSelect.html(html);

                                //重新渲染select
                                form.render('select');

                                poiSelect.next().addClass("layui-form-selected");
                                poiSelect.next().find("input[placeholder='POI']").focus();
                                poiSelect.next().find("input[placeholder='POI']").val(input);
                                poiInvertSelect();
                            }
                        }
                    });
                }

                return false;
            }
        }

        /*input失去焦点事件*/
        function selectPoi4(){
            changRightShowDataType();
            var activeType = $(this).attr("data-type");
            var input = $(this).val();
            console.log(input);
            //其他
            if(activeType==6){
                hideRightMap();
                if(input=="" || input==undefined){
                    return false;
                }
                var dayNum = schedule_id = input_poIid = active_id = 0;
                var hidden_active = $(this).parent().parent();
                dayNum = hidden_active.find(".active_id").attr('data-day')
                schedule_id = hidden_active.find(".active_id").attr('data-sid')
                active_id = hidden_active.find(".active_id").attr('value');
                //赋值setTitle
                $.post("/admin/quicktrip/updateActiveInfo", {active_id: active_id, title: input, activeType: activeType}, function (res) {
                    getRecommendList(input_poIid, dayNum, schedule_id, activeType, active_id,input)
                }, 'json');
            }
            return false;

        }
        //*****************************************************************
        ///*******************************右侧栏/**************************
        //*****************************************************************
        //选中图片功能
        $(".poiinfo").on("click",'.poi-detail-item-imgbox',function(){
            var shadow= $(this).find(".poi_img_shadow")
            if($(shadow).hasClass("poicheckeds")){
                $(shadow).removeClass("poicheckeds");
            }else{
                $(shadow).addClass("poicheckeds");
            }
        });

        //右侧 功能按钮
        $('.btnfix').click(function () {
            var shadow =$('.ActionButton')
            if($(shadow).hasClass("poibtnshow")){
                $(shadow).removeClass("poibtnshow");

            }else{
                $(shadow).addClass("poibtnshow");
            }
        });

        //下拉核价
        $(".dragDownPricing").click(function(){ //行程方案
            $(".dragUpPricing").removeClass("showTrip").addClass("hideTrip");
            $(".dragUpPricing").show();
            $(this).hide();
            $(".box-price").slideUp(250);
            $('.Travel-plan').show()
            //$('.trafficCar').removeClass('hidden')
            sessionStorage.setItem("isClosePricing",false);
        });

        $(".dragUpPricing").click(function () { //核价信息
            $(this).hide();
            var loading = layer.load(2, {
                shade: [0.5, 'gray'],
                content: '加载中...',
                success: function (layero) {
                    layero.find('.layui-layer-content').css({
                        'padding-top': '39px',
                        'width': '60px'
                    });
                }
            });
            setTimeout(function () {
                window.location.reload();
                $(".box-price").removeClass("hideTrip").addClass("showTrip");
                $(".dragDownPricing").show();
                $(".box-price").slideDown(250);
                $('.Travel-plan').hide();
                sessionStorage.setItem("isClosePricing",true);
            },500)

        });

        // 上拉trip
        $(".dragUp").click(function(){
            $("#customer").removeClass("showTrip").addClass("hideTrip");
            $(".dragDown").show();
            $(this).hide();
            $("#customer").slideUp(250);
            sessionStorage.setItem("isClose",true);
        });

        $(".dragDown").click(function () {
            $("#customer").removeClass("hideTrip").addClass("showTrip");
            $(".dragUp").show();
            $(this).hide();
            $("#customer").slideDown(250);
            sessionStorage.setItem("isClose",false)
        });

        $(document).ready(function(){
            anchor = sessionStorage.getItem("tripmake_anchor");
            sessionStorage.setItem("tripmake_anchor","");
            {notempty name='$tripid'}
            if(anchor!="" && anchor!=undefined){
                window.location.href = "/admin/quicktrip/tripmakepartner?id="+{$tripid}+"#"+anchor;
            }else{
                if(location.hash!="" && location.hash!="#null"){
                    window.location.href = "/admin/quicktrip/tripmakepartner?id="+{$tripid}+"#";
                }
            }
            {/notempty}
        });

        //延迟绑定keyup事件
        window.onload = poiInvertSelect;

        //ajax查询POI 反选城市
        function poiInvertSelect(){
            $(".selectpoilist input").on('keyup',selectPoi2);
            $(".selectpoilist input[name=other]").on('blur',selectPoi4);
        }


        //*****************************************************************
        ///**************************详细定制/**************************
        //*****************************************************************
        //显示/隐藏下拉 机场 酒店 详细定制补充信息
        $('body').on('click','.detail-create',function (event){
            event.stopPropagation();
            var shadow= $(this).parent().find(".detail-create-list")
            if($(shadow).hasClass("detailcustomshow")){
                $('.detailcustomshow').removeClass("detailcustomshow");
            }else{
                $('.detailcustomshow').removeClass("detailcustomshow");
                $(shadow).addClass("detailcustomshow");
            }
        });

        //点击酒店 机场动态创建信息
        $('body').on('click','.detail-create-list-item',function () {
            var typeId = $(this).val();
            var typeName = $(this).text();
            var activeType = $(this).parent().parent().find(".activeType");
            activeType.attr("value",typeId);
            $(this).parent().parent().find(".detail-create").html("<span>"+typeName+"</span>");

            var active_id = activeType.parent().parent().find(".active_id").attr("value");
            var dayNum = activeType.parent().parent().find(".active_id").attr("data-day");
            var schedule_id = activeType.parent().parent().find(".active_id").attr("data-sid");

            var city_id = $("select[name='city_"+active_id+"']").val();
            if(typeId !==6){
                var input=$(this).parent().parent().parent().find('.active_id').val();
                //判断是否为其他类型和非其他类型
                var active_html = '<select data-id="'+active_id+'" data-type="'+typeId+'" name="activeSelect_'+active_id+'" lay-filter="activeSelect" lay-search class="activeSelect_slt" id="activeSelect_'+active_id+'" data-day="'+dayNum+'" data-sid="'+schedule_id+'">';
            }else{
                var active_html = '<input name="other" data-id="'+active_id+'" data-type="6" value="" class="layui-input" placeholder="输入标题后回车">';
            }
            $(this).parent().parent().next().next().children().remove();
            $(this).parent().parent().next().next().append(active_html);
            switch(typeId){
                case 1://POI

                    break;
                case 2://接机

                    break;
                case 3://送机

                    break;
                case 4://酒店

                    break;
                case 5://特色体验

                    break;
                case 6://其他

                    break;
            }

            if(city_id==undefined && city_id<=0){
                city_id = 0;
            }
            setActiveSelect(typeId,city_id,active_id);

            $('.detailcustomshow').removeClass("detailcustomshow");

            allSortKeyNum();
        });
        $(document).on("click",function(){
            $('.detailcustomshow').removeClass("detailcustomshow");
        });
        //地址匹配

        //选中addressBox 设置
        $(document).on("click",".addressbox span",function(){
            var address = $(this).html();
            //查找当前需要赋值的input
            var addressBox = $(this).parent();
            var addressInput = $(addressBox).prev();
            var addressFormatInput = $(addressBox).next();
            setAddress(address,addressInput,addressFormatInput);
            //删除addressbox
            resetAddressBox();
        });
        //取消addressBox弹框
        $(document).on("click",'*:not(.addressbox_span)',function(event){
            resetAddressBox();
        })
        //重置addressBox
        function resetAddressBox()
        {
            $(".addressbox").html('');
        }
        var timeoutId = 0;
        $("#newpoi").on('input','input[name=name]',function(){
            console.log($(this).val())
            resetAddressBox();
            //添加addressbox
            clearTimeout(timeoutId);
            var value = $(this);
            timeoutId = setTimeout(function(){
                getAddressList(value);
            },1000)

        });
        //添加新景点
        form.on('submit(newpoi)', function(data) {
            var lat = $("input[name=lat]").val();
            var lng = $("input[name=lng]").val();
            var place_id = $("input[name=place_id]").val();
            if(lat=="" || lng=="" || lat==undefined || lng==undefined){
                layer.msg("请填写名称匹配地址");
                return false;
            }
            var groupid = $('#newpoi select[name=groupid]').val();
            var type_id = $('#newpoi_typeid').val();
            //酒店分类是5 active分类是4
            if(type_id==5){
                type_id = 4;
            }
            var poi_load_index = layer.load(1);
            $.ajax({
                url:"{:url('admin/poi/addpoi')}",
                data:$('#newpoi').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    //添加成功
                    $("#rightNewPOI").hide();
                    var active_id = $("#rightNewPOI").attr("active_id");
                    //将新增poi放置到来时的地方
                    putNewPoiToDay(groupid,active_id,res.data.id,poi_load_index,type_id);
                }
            })
            return false;
        });

        function putNewPoiToDay(city_id,active_id,poi_id,poi_load_index,type_id){
            $.post("{:url('admin/quicktrip/getActiveData')}",{active_id:active_id,city_id:city_id,type_id:type_id},function(data){
                $.ajax({
                    url:"{:url('admin/quicktrip/setpoi')}",
                    data:{active_id:active_id,poiid:poi_id},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.close(poi_load_index);
                        var html="<option value=''>POI</option>";
                        for(var i=0;i<data.length;i++){
                            html += "<option value="+data[i]["id"]+">"+data[i]["name"]+"</option>";
                        }
                        $("#activeSelect_"+active_id).html(html);
                        $("select[name=city_"+active_id+"]").val(city_id);
                        $("#activeSelect_"+active_id).val(poi_id);
                        //重新渲染select
                        form.render('select');
                        poiInvertSelect();
                    }
                });
            },"Json");
        }

        function addNewPOi(typeid,typename,poiname,city_id){
            if(typeid==4){
                typeid = 5;
            }
            $("#rightNewPOI").removeClass("hidden");
            //请空老数据
            $("#rightNewPOI button[type=reset]").click();
            $("#seeupload11").children().remove();
            $("#upload-thumb11").val("");
            //赋值类型
            $("#newpoi_typename").html(typename);
            $("#newpoi_typeid").val(typeid);
            $("#poichname").val(poiname);
            $("#newpoi_lat").val("");
            $("#newpoi_lng").val("");
            $("#newpoi_place_id").val("");
            //清空中文简介
            ue2.setContent("");
            //SearchAddress(poiname,$(".addressbox"));
            var select = $("select[name=groupid]");
            select.val(city_id);

            form.render();
        }

        $(document).on("click",".item-toggle-p",function(){
            var text = $(this).find(".dragModule").text();
            var expanded= $(this).attr('data-expanded')
            sessionStorage.setItem('expanded',expanded)
            if(text=="收起"){
                $(this).find(".dragModule").text("展开");
                $(this).next().slideUp(250);
            }else{
                var allToggle = $(".item-toggle-p");
                $.each(allToggle,function(i,v){
                    $(v).next().slideUp(250);
                    $(v).find(".dragModule").text("展开");
                });
                $(this).find(".dragModule").text("收起");
                $(this).next().slideDown(250);
            }
        });

        //更新active数据
        $(".updatePoiInfo_btn").click(function(){
            var form = $("#updateActiveInfo");
            var data = form.serialize();
            $.post("/admin/quicktrip/updateActiveInfo",data,function(res){
                var active_id = $("#updateActiveInfo input[name=active_id]").val();
                var title = $("#updateActiveInfo input[name=title]").val();
                $('.selectpoilist input[data-id='+active_id+'][name=other]').val(title);
                layer.msg(res.msg)
            },"json")
        });

        //删除上传的图片
        $('body').on("click",'#poiImgShow i',function(){
            var data_type = $(this).parent().parent().parent().attr("data-type");
            $(this).parent().remove();
            var img_str = '';
            var img_src = [];
            var img_arr = $("#poiImgShow img");
            if(img_arr.length>0){
                $.each(img_arr,function(i,v){
                    img_src.push($(v).attr('src'));
                });
                img_str = img_src.join(",");
            }else{
                img_str = "";
            }
            if($.inArray(parseInt(data_type),global_active_type_arr)>-1){
                $("input[name=poiImg]").val(img_str);
            }else if($.inArray(data_type,['6'])>-1){
                $("input[name=other_images]").val(img_str);
            }
        });

        var transport_day = 0;
        var transport_day_type = "";
        $(".trafficCar").click(function(){
            var shadow= $(this);
            $('.activetrafficCar').removeClass("activetrafficCar");
            $(shadow).addClass("activetrafficCar");
            transport_day = $(this).attr('data-id');
            transport_day_type = $(this).attr('data-type');
            changRightShowDataType("day")
        });
        //点击添加交通分类
        $("body").on('click','.transport_item',function(){
            var type_id = $(this).attr('data-type');
            var type_name = $(this).text();
            console.log(transport_day,type_id,transport_day_type);
            if(transport_day==0){
                layer.msg("请点击日期");return false;
            }
            var day_type_arr = [];
            if(transport_day_type!="" && transport_day_type!=undefined){
                day_type_arr = transport_day_type.split(',');
                if($.inArray(type_id,day_type_arr)!=-1){
                    layer.msg("请勿重复添加!");
                    return false;
                }
                if(day_type_arr.length>=3){
                    layer.msg("每日最多添加两种交通类型!");
                    return false;
                }

                // if($.inArray(transport_day_type,['3','4','5','6','7'])>-1 &&  $.inArray(type_id,['3','4','5','6','7'])>-1){
                //     layer.msg(type_name+"不能和已选类型同时存在!");
                //     return false;
                // }
            }
            day_type_arr.push(type_id)
            transport_day_type = day_type_arr.join(',');
            var upd_trans_load_index = 0;
            $.post("/admin/quicktrip/updTransportType",{schedule_id:transport_day,day_type:transport_day_type},function(data){
                layer.msg(data.msg);
                if(data.code==1){
                    //push node
                    var html = '<p class="layui-btn-info layui-btn layui-btn-xs layui-btn-normal trafficCar_item" data-id="'+type_id+'">'+type_name+'<i class="layui-icon"></i></p>\n';
                    $(".trafficCar_"+transport_day).append(html);
                    $(".trafficCar_"+transport_day).attr("data-type",transport_day_type);
                }
            },"json");

        });
        //点击删除交通分类
        $("body").on('click','.trafficCar_item',function(){
            var _that = this;
            var my_id = $(this).attr("data-id");
            var trans_del_type = $(this).parent().attr("data-type");
            var day_id = $(this).parent().attr("data-id");
            var trans_del_type_arr = trans_del_type.split(',');
            var trans_del_day_type =  '';
            console.log(my_id,trans_del_type,trans_del_type_arr,$.inArray(parseInt(my_id),trans_del_type_arr))
            if($.inArray(my_id,trans_del_type_arr)==-1){
                layer.msg("删除失败");return false;
            }
            trans_del_type_arr.splice($.inArray(my_id,trans_del_type_arr),1);
            if(trans_del_type_arr.length<1){
                trans_del_day_type = "";
            }else{
                trans_del_day_type = trans_del_type_arr.join(",");
            }
            $.post("/admin/quicktrip/updTransportType",{schedule_id:day_id,day_type:trans_del_day_type,'upd_type':'delete'},function(data){
                layer.msg(data.msg);
                if(data.code==1){
                    //push node
                    $(_that).remove();
                    $(".trafficCar_"+transport_day).attr("data-type",trans_del_day_type);
                    transport_day_type = trans_del_day_type;
                }
            },"json");
        });
        //切换右侧数据栏
        function changRightShowDataType(type="poi")
        {
            if(type=='poi'){
                $('.activetrafficCar').removeClass("activetrafficCar"); //去掉添加交通类型的边框
                $("#poiDataInfo").show();
                $("#dayDataInfo").hide();
            }else{
                $("#poiDataInfo").hide();
                $("#dayDataInfo").show();
            }
        }

        $(".trans_type_close").click(function(){
            $(this).parent().parent().hide();
        });

        //一键切换快速 -显示核价部分
        $('.ManualSwitch').click(function (){
            if($('.box-price').hasClass("switcherset")){
                //$('.box').hide()  //遮罩为打开
                // layer.msg('底部核价已隐藏')
                $(".box-price").removeClass("switcherset")
                $(".box-price").hide(); //核价板块
                $('.Travel-plan').show() //行程方案 板块
                $(".dragUpPricing").hide(); //核价信息 箭头
                $(".dragDownPricing").hide(); //行程方案 箭头
                $('.ActionButton').removeClass("poibtnshow");
                //$('.trafficCar').addClass('hidden')
                $('.ManualSwitch-span').html('核价显示')
//                sessionStorage.setItem("isClosePricing",true)
//                 $(".trafficCar").eq(0).css('backgroundColor','#eee');
                //$(".trafficCar").eq(0).prev().css('opacity','1');
                //$(".trafficCar").eq(0).parent().css('z-index','0');
                $("#dayDataInfo").hide();

            }else{
                // layer.msg('底部核价已显示')
                $('.box-price').addClass("switcherset"); //删除
                $(".box-price").hide();  //核价板块
                $('.Travel-plan').show() //行程方案 板块
                $(".dragUpPricing").show();
                $(".dragDownPricing").hide();
                // sessionStorage.setItem("isClosePricing",true)
                $('.ActionButton').removeClass("poibtnshow");
                // window.location.reload()
                //$('.trafficCar').removeClass('hidden');
                $('.ManualSwitch-span').html('核价隐藏');
//                sessionStorage.setItem("isClosePricing",false)
                //默认选中第一个交通标签
                //$(".trafficCar").eq(0).click();
                //显示遮罩
                if(is_show_shadow==1){
                    // $(".trafficCar").eq(0).parent().css('z-index','12');
                    // $(".trafficCar").eq(0).css('backgroundColor','#fff');
                    // $(".trafficCar").eq(0).prev().css('opacity','0.3');
                    ///$('.box').show()  //遮罩为打开
                }

                //主动点击核价信息展示
                $('.dragUpPricing').click();
            }
        });
        // 点击遮罩关掉
        $('.box').click(function () {
            $(this).hide()
            $(".trafficCar").eq(0).parent().css('z-index','0');
            // $(".trafficCar").eq(0).css('backgroundColor','#eee');
            $(".trafficCar").eq(0).prev().css('opacity','1');
        });
        //启用门票
        $(document).on("click",".ticketBtn",function(){
            var active_id = $(this).parent().parent().parent().find("input[name='active_id']").val();
            var value = $(this).attr("data-value");
            var that = $(this);
            $.ajax({
                url:"{:url('admin/quicktrip/setTicketStatus')}",
                data:{active_id:active_id,value:value},
                type:'post',
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        if(value==0){
                            that.attr("data-value",1);
                            that.text("启用中");
                            that.removeClass("layui-btn-danger");
                            $(".updTicketPeopleNum").show();
                        }else{
                            that.attr("data-value",0);
                            that.text("未启用");
                            that.addClass("layui-btn-danger");
                            that.addClass("layui-btn-danger");
                            $(".updTicketPeopleNum").hide();
                        }
                    }
                }
            });

            return false;
        });
        //更新门票购买数量
        $(document).on("click",".updTicketPeopleNum",function(){
            var active_id = $(this).parent().parent().parent().find("input[name='active_id']").val();
            var ticketData = [];
            var ticketTable = $("#ticket_body input[name=people_num]");
            $.each(ticketTable,function(i,v){
                var ticket_id = $(v).attr('data-ticketid');
                var number = $(v).val();
                if(number=='' || number==0 || number==undefined){
                    return true;
                }
                ticketData.push({ticket_id:ticket_id,number:number});
            })
            if(ticketData.length<1){
                layer.msg("请添加门票且填写购买数量");return false;
            }
            var ticketJosn = JSON.stringify(ticketData);
            $.ajax({
                url:"{:url('admin/quicktrip/setTicketPeopleNum')}",
                data:{active_id:active_id,ticketData:ticketJosn},
                type:'post',
                success:function(res) {
                    layer.msg(res.msg);
                }
            });

            return false;
        });

        //保存输入的简要说明
        $(".day-description").blur(function(){
            var schedule_id = $(this).attr('data-id');
            var value = $(this).val();
            $.post("{:url('admin/quicktrip/saveDayDescription')}",{schedule_id:schedule_id,value:value},function(res){
                if(res.code<1){
                    layer.msg(res.msg);
                }
            },'json')
        })

    });

    //重新排序序号
    function sortKeyNumber(schedule_id){
        var newNum = 1;
        $("#li_"+schedule_id).find(".messdiv").each(function(){
            var activeType = $(this).find(".activeType").attr("value");
            activeType = parseInt(activeType);
            if(activeType!==6){
                $(this).find(".keyNumber").text(newNum);
                newNum++;
            }
        });
    }

    //全部重新排序序号
    function allSortKeyNum(){
        $(".schedule_id").each(function(){
            var schedule_id = $(this).attr("value");
            sortKeyNumber(schedule_id);
        });
    }

    allSortKeyNum();

    //layer定义结束-------------------------------------------------------------------
    //获取节点前后距离
    function getPointDistace(active_id,schedule_id){
        $.ajax({
            url:"{:url('admin/quicktrip/getPointDistance')}",
            data:{active_id:active_id,groupid:schedule_id},
            type:'post',
            async: false,
            success:function(data) {
                for(var i=0;i<data.length;i++){
                    var thisDistance = $("#activeSelect_"+data[i]['id']).parent().parent().next(".distance-list");
                    var html = '';
                    if(data[i]['distance'] > 0){
                        html = "<i class='layui-icon'>&#xe715;</i>相距"+data[i]['distance']+"公里";
                    }
//                    console.log(active_id);
//                    console.log(html);
                    thisDistance.find(".distance-list-car").html(html);
                }
            }
        });

        return false;
    }
</script>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;
        upload.render({
            elem: '#upload11'
            ,url: "{:url('common/upload')}"
            ,multiple: true
            ,accept:"images"
            ,size:"50000"
            ,done: function(res){
                //上传完毕回调
                layer.closeAll('loading');
                if(res.code == 2) {
                    $('#seeupload11').append('<span class="uploadimgbox"><img class="layui-upload-img" src="'+res.src+'"><i class="layui-icon">&#x1006;</i></span>');
                    $('#upload-thumb11').val($('#upload-thumb11').val()+","+res.src);
                } else {
                    layer.msg(res.msg);
                }
            }
            ,error: function(){
                //请求异常回调
                //演示失败状态，并实现重传
                layer.closeAll('loading');
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
            ,before:function(){
                layer.load(2);
            }
        });
        upload.render({
            elem: '#otherimg_btn' //绑定元素
            ,url: "{:url('common/upload')}" //上传接口
            ,done: function(result){
                //上传完毕回调
                layer.closeAll('loading');
                if(result.code == 2) {
                    var src = result.src;
                    var html = '<img class="layui-upload-img" src="' + src + '" style="width:85px;padding:5px;"><i class="layui-icon">&#x1006;</i>';
                    $("#poiImgShow").append(html);
                    var img = $("input[name=other_images]").val();
                    $("input[name=other_images]").val(img + "," + src);
                    layer.msg("上传成功");
                }else{
                    layer.msg(result.msg);
                }
            }
            ,error: function(){
                //请求异常回调
                layer.closeAll('loading');
                layer.msg("上传失败");
                return false;
            }
            ,before:function(){
                layer.load(2);
            }
        });
    });

    $("#seeupload11").on("click",".layui-icon",function(){
        $(this).parent().remove();
        thumb("seeupload11",11);
    });

    function thumb(obj,n){
        var thumbs="";
        $("#"+obj).find("img").each(function(){
            var url=$(this).attr("src");
            thumbs+=","+url;
        });
        $("#upload-thumb"+n).val(thumbs);
    }

</script>
<script>
    //核价
    /*转换正负整数*/
    function parseInputNumber(_that){
        var str = $(_that).val();
        if(str.indexOf(".")>-1){
            $(_that).val(str.slice(0,str.indexOf(".")));
        }
    }
    //航班信息提交
    $(".airportDetail,.airportPrice").bind("input propertychange", function () {
        var schedule_id = $(this).parent().parent().parent().attr("data-id");
        var arr = [];
        if($(this).attr('type')=='number'){
            parseInputNumber(this)
        }
        $(this).parent().parent().find(".airportDiv").each(function(){
            var dataId = $(this).find(".airportDetail").attr("data-id");
            var airportDetail = $(this).find(".airportDetail").val() || "";
            var airportPrice = $(this).find(".airportPrice").val() || 0;
            var airArr = [dataId,airportDetail,airportPrice];
            arr.push(airArr);
        });

        $.ajax({
            url:"{:url('admin/quicktrip/changePriceTable')}",
            data:{type:'airport',schedule_id:schedule_id,name:'airport_json',data:arr},
            type:'post',
            success:function(res) {
                if(res.code!==1){
                    layer.msg(res.msg);
                }
            }
        });

        countPrice();

        return false;
    });
    //酒店信息提交
    $(".hotelDetail,.hotelPrice,.totalHotelPrice").bind("input propertychange", function () {
        var name = $(this).attr("name");
        var value = $(this).val();
        var schedule_id;
        var alldayhotel;
        if(name=='hotelDetail'){
            schedule_id = $(this).parent().parent().attr("data-id");
            alldayhotel = $(this).parent().find(".alldayhotel").attr("value");
        }else if(name=='totalHotelPrice'){
            schedule_id = $(this).parent().parent().parent().attr("data-id");
            alldayhotel = $(this).parent().parent().find(".alldayhotel").attr("value");
            var totalPrice = $(this).val();
            var hotelPrice = $(this).parent().find(".hotelPrice");
            value = 0;
            if(totalPrice>0 && totalPrice!==''){
                var num = hotelPrice.attr("data-num");
                value = Math.round(totalPrice/num);
                hotelPrice.val(value);
            }else{
                hotelPrice.val('');
            }
            name = 'hotelPrice';
            countPrice();
        }else{
            schedule_id = $(this).parent().parent().parent().attr("data-id");
            alldayhotel = $(this).parent().parent().find(".alldayhotel").attr("value");

            parseInputNumber(this);
            countHotelPrice();
            countPrice();
        }

        $.ajax({
            url:"{:url('admin/quicktrip/changePriceTable')}",
            data:{type:'hotel',schedule_id:schedule_id,name:name,data:value,alldayhotel:alldayhotel},
            type:'post',
            success:function(res) {
                if(res.code!==1){
                    layer.msg(res.msg);
                }
            }
        });

        return false;
    });
    //租车信息提交
    $(".driveDetail,.drivePrice").bind("input propertychange", function () {
        var name = $(this).attr("name");
        var value = $(this).val();
        var schedule_id = $(this).parent().parent().attr("data-id");
        var alldaydrive = $(this).parent().find(".alldaydrive").attr("value");
        if(name=='drivePrice'){
            parseInputNumber(this);
            countPrice();
        }

        $.ajax({
            url:"{:url('admin/quicktrip/changePriceTable')}",
            data:{type:'drive',schedule_id:schedule_id,name:name,data:value,alldaydrive:alldaydrive},
            type:'post',
            success:function(res) {
                if(res.code!==1){
                    layer.msg(res.msg);
                }
            }
        });

        return false;
    });
    //其他信息提交
    $(".ajaxSubmit").bind("input propertychange", function () {
        var name = $(this).attr("name");
        var value = $(this).val();
        var schedule_id = $(this).parent().parent().attr("data-id");
        if($(this).attr('type')=='number'){
            parseInputNumber(this)
        }
        $.ajax({
            url:"{:url('admin/quicktrip/changePriceTable')}",
            data:{type:'other',schedule_id:schedule_id,name:name,data:value},
            type:'post',
            success:function(res) {
                if(res.code!==1){
                    layer.msg(res.msg);
                }
            }
        });

        countPrice();

        return false;
    });

    function countHotelPrice(){
        $(".hotelPrice").each(function(){
            var hotelPrice = $(this);
            var value = hotelPrice.val();
            if(value>0 && value!==''){
                var num = hotelPrice.attr("data-num");
                var totalHotelPrice = value*num;
                hotelPrice.siblings(".totalHotelPrice").val(totalHotelPrice);
            }else{
                hotelPrice.siblings(".totalHotelPrice").val('');
            }
        });
    }

    //加和 价格
    function countPrice(){
        //航班报价
        var airportPrice = 0;
        var airportPrice_ipt = $("input[name='airportPrice_ipt']").val();
        var airportPrice_btn = $(".airportPrice_btn ").attr("value");
        if(airportPrice_btn>0){
            if(airportPrice_ipt>0){

            }else{
                airportPrice_ipt = 0;
            }
            airportPrice = parseInt(airportPrice_ipt);
        }else{
            $(".airportPrice").each(function(){
                var value = $(this).val();
                value = parseInt(value);
                if(value>0 && value!==''){
                    airportPrice = airportPrice+value;
                }
            });
            $("#count_airportPrice").html(airportPrice);
        }

        //酒店报价
        var count_hotelPrice = 0;
        var hotelPrice_ipt = $("input[name='hotelPrice_ipt']").val();
        var hotelPrice_btn = $(".hotelPrice_btn ").attr("value");
        if(hotelPrice_btn>0){
            if(hotelPrice_ipt>0){

            }else{
                hotelPrice_ipt = 0;
            }
            count_hotelPrice = parseInt(hotelPrice_ipt);
        }else{
            $(".totalHotelPrice").each(function(){
                var value = $(this).val();
                value = parseInt(value);
                if(value>0 && value!==''){
                    count_hotelPrice = count_hotelPrice+value;
                }
            });
            $("#count_hotelPrice").html(count_hotelPrice);
        }


        //租车报价
        var count_drivePrice = 0;
        var drivePrice_ipt = $("input[name='drivePrice_ipt']").val();
        var drivePrice_btn = $(".drivePrice_btn ").attr("value");
        if(drivePrice_btn>0){
            if(drivePrice_ipt>0){

            }else{
                drivePrice_ipt = 0;
            }
            count_drivePrice = parseInt(drivePrice_ipt);
        }else{
            $(".drivePrice").each(function(){
                var value = $(this).val();
                value = parseInt(value);
                if(value>0 && value!==''){
                    count_drivePrice = count_drivePrice+value;
                }
            });
            $("#count_drivePrice").html(count_drivePrice);
        }


        // //包车报价
        // var count_carOrderPrice = 0;
        // var carPrice_ipt = $("input[name='carPrice_ipt']").val();
        var carPrice_btn = $(".carPrice_btn ").attr("value");
        // if(carPrice_btn>0){
        //     if(carPrice_ipt>0){
        //
        //     }else{
        //         carPrice_ipt = 0;
        //     }
        //     count_carOrderPrice = parseInt(carPrice_ipt);
        // }else{
        //     $(".totalCarPrice").each(function(){
        //         var value = $(this).html();
        //         value = parseInt(value);
        //         if(value>0 && value!==''){
        //             count_carOrderPrice = count_carOrderPrice+value;
        //         }
        //     });
        //     $("#count_carPriceOrder").html(count_carOrderPrice);
        // }
        //获取设置的用车价格
        var count_carPrice = {$totalCarPriceCNY|default=0};
        $("#count_carPrice").html(count_carPrice);

        //门票报价
        var count_ticketPrice = 0;
        $(".totalTicketPrice").each(function(){
            var value = $(this).val();
            value = parseInt(value);
            if(value>0 && value!==''){
                count_ticketPrice = count_ticketPrice+value;
            }
        });
        $("#count_ticketPrice").html(count_ticketPrice);


        //保险报价
        var count_insurancePrice = 0;
        $(".totalInsurancePrice").each(function(){
            var value = $(this).val();
            value = parseInt(value);
            if(value>0 && value!==''){
                count_insurancePrice = count_insurancePrice+value;
            }
        });
        $("#count_insurancePrice").html(count_insurancePrice);


        //附加报价
        var count_extraPrice = 0;
        $(".totalExtraPrice").each(function(){
            var value = $(this).val();
            if(value.substr(0,1)=='-'){
                value = value.substr(1,value.length);
                value = parseInt(value);
                count_extraPrice = count_extraPrice-value;
            }else{
                value = parseInt(value);
                if(value>0 && value!==''){
                    count_extraPrice = count_extraPrice+value;
                }
            }
        });
        $("#count_extraPrice").html(count_extraPrice);


        //总价
        var totalPrice = airportPrice + count_hotelPrice + count_carPrice + count_ticketPrice + count_drivePrice + count_insurancePrice + count_extraPrice;
        $("#totalPrice").html(totalPrice);


        var tripid = $("#tripid").attr("value");
        $.ajax({
            url:"{:url('admin/quicktrip/saveTotalPrice')}",
            data:{
                tripid:tripid,
                total_price:totalPrice,
                airportPrice_btn:airportPrice_btn,
                hotelPrice_btn:hotelPrice_btn,
                drivePrice_btn:drivePrice_btn,
                carPrice_btn:carPrice_btn,
                totalAirportPrice:airportPrice,
                totalHotelPrice:count_hotelPrice,
                totalDrivePrice:count_drivePrice,
                totalTransPrice:count_carPrice,
                totalTicketPrice:count_ticketPrice,
                totalExtraPrice:count_extraPrice
            },
            type:'post',
            success:function(res) {
                if(res.code!==1){
                    layer.msg(res.msg);
                }
                updPriceRate();
            }
        });


    }
    function transBtn(){
        var airportPrice_btn  = $(".airportPrice_btn").attr("value");
        var hotelPrice_btn  = $(".hotelPrice_btn").attr("value");
        var drivePrice_btn  = $(".drivePrice_btn").attr("value");
        var carPrice_btn  = $(".carPrice_btn").attr("value");

        if(airportPrice_btn<1){
            $(".airportPrice_btn").removeClass("layui-btn-warm");
            $(".airportPrice_ipt").hide();
            $(".airportPrice_count_ipt").show();
        }else{
            $(".airportPrice_btn").addClass("layui-btn-warm");
            $(".airportPrice_ipt").show();
            $(".airportPrice_count_ipt").hide();
        }
        if(hotelPrice_btn<1){
            $(".hotelPrice_btn").removeClass("layui-btn-warm");
            $(".hotelPrice_ipt").hide();
            $(".hotelPrice_count_ipt").show();
        }else{
            $(".hotelPrice_btn").addClass("layui-btn-warm");
            $(".hotelPrice_ipt").show();
            $(".hotelPrice_count_ipt").hide();
        }
        if(drivePrice_btn<1){
            $(".drivePrice_btn").removeClass("layui-btn-warm");
            $(".drivePrice_ipt").hide();
            $(".drivePrice_count_ipt").show();
        }else{
            $(".drivePrice_btn").addClass("layui-btn-warm");
            $(".drivePrice_ipt").show();
            $(".drivePrice_count_ipt").hide();
        }
        if(carPrice_btn<1){
            $(".carPrice_btn").removeClass("layui-btn-warm");
            $(".carPrice_ipt").hide();
            $(".carPrice_count_ipt").show();
        }else{
            $(".carPrice_btn").addClass("layui-btn-warm");
            $(".carPrice_ipt").show();
            $(".carPrice_count_ipt").hide();
        }
        countPrice();
    }
    var isClosePricingFlag = sessionStorage.getItem("isClosePricing");
    if(isClosePricingFlag=='true'){
        countHotelPrice();
        transBtn();
    }
    //更新利率
    $(".priceRate").change(function(){
        //更新价格利率
        updPriceRate();
    })

    function updPriceRate(){
        var rateArr = $(".priceRate");
        var ratePost = [];
        var rateFlag = true;
        $.each(rateArr,function(i,v){
            var key = $(v).attr('name');
            var value = $(v).val();
            if(value=="" || parseFloat(value)==0){
                rateFlag = false;
                return false;
            }
            ratePost.push({name:key,value:value});
        })
        console.log(rateFlag);
        if(!rateFlag){
            layer.msg("请检查所有的利率，不能小于0");return false;
        }
        ratePost = JSON.stringify(ratePost);
        var tripid = $("#tripid").attr("value");
        $.post('/admin/quicktrip/updatePriceRate',{tripid:tripid,ratePost:ratePost},function(data){
            if(data.code<1){
                //修改失败
                return false;
            }
            var res = data.data;
            //更新页面价格
            updSalePrice(res.total_sale_price,res.salePrice);
        },'json')
    }
    //更新页面售价
    function updSalePrice(total_sale_price,salePrice)
    {
        var salePriceArr = $(".salePrice");//获取售价列表
        $.each(salePriceArr,function(i,v){
            sale_price = Math.ceil(salePrice[i]);
            $(v).text(sale_price);
        })
        //赋值总售价
        $("#totalSalePrice").text(total_sale_price);
    }
    //机票自填
    $(".airportPrice_btn").click(function(){
        var value = $(this).attr("value");
        if(value>0){
            $(this).removeClass("layui-btn-warm");
            $(this).attr("value",0);
            $(".airportPrice_ipt").hide();
            $(".airportPrice_count_ipt").show();
        }else{
            $(this).addClass("layui-btn-warm");
            $(this).attr("value",1);
            $(".airportPrice_ipt").show();
            $(".airportPrice_count_ipt").hide();
        }
        countPrice();
    });
    $("input[name='airportPrice_ipt']").bind('input propertychange',function(){
        countPrice();
    });

    //酒店自填
    $(".hotelPrice_btn").click(function(){
        var value = $(this).attr("value");
        if(value>0){
            $(this).removeClass("layui-btn-warm");
            $(this).attr("value",0);
            $(".hotelPrice_ipt").hide();
            $(".hotelPrice_count_ipt").show();
        }else{
            $(this).addClass("layui-btn-warm");
            $(this).attr("value",1);
            $(".hotelPrice_ipt").show();
            $(".hotelPrice_count_ipt").hide();
        }
        countPrice();
    });
    $("input[name='hotelPrice_ipt']").bind('input propertychange',function(){
        countPrice();
    });

    //租车自填
    $(".drivePrice_btn").click(function(){
        var value = $(this).attr("value");
        if(value>0){
            $(this).removeClass("layui-btn-warm");
            $(this).attr("value",0);
            $(".drivePrice_ipt").hide();
            $(".drivePrice_count_ipt").show();
        }else{
            $(this).addClass("layui-btn-warm");
            $(this).attr("value",1);
            $(".drivePrice_ipt").show();
            $(".drivePrice_count_ipt").hide();
        }
        countPrice();
    });
    $("input[name='drivePrice_ipt']").bind('input propertychange',function(){
        countPrice();
    });

    //包车自填
    $(".carPrice_btn").click(function(){
        var value = $(this).attr("value");
        if(value>0){
            $(this).removeClass("layui-btn-warm");
            $(this).attr("value",0);
            $(".carPrice_ipt").hide();
            $(".carPrice_count_ipt").show();
        }else{
            $(this).addClass("layui-btn-warm");
            $(this).attr("value",1);
            $(".carPrice_ipt").show();
            $(".carPrice_count_ipt").hide();
        }
        countPrice();
    });
    $("input[name='carPrice_ipt']").bind('input propertychange',function(){
        countPrice();
    });

    //删除司导返程
    $(".deleteReturnJourney").click(function(){
        var day_id = $(this).attr('data-day');
        layer.confirm('确认删除司导返程?', {icon: 3, title:'提示'}, function(index){
            //不设置司导返程
            $.post("/admin/quicktrip/updReturnJourney",{day_id:day_id,status:1},function(data){
                layer.msg(data.msg);
                if(data.code==1){
                    setTimeout(function(){
                        window.location.reload();
                    })
                }
            },'json')
        });
    });
    //删除司导返程
    $(".setReturnJourney").click(function(){
        var day_id = $(this).attr('data-day');
        layer.confirm('新增司导返程?', {icon: 3, title:'提示'}, function(index){
            //不设置司导返程
            $.post("/admin/quicktrip/updReturnJourney",{day_id:day_id,status:2},function(data){
                layer.msg(data.msg);
                if(data.code==1){
                    setTimeout(function(){
                        window.location.reload();
                    })
                }
            },'json')
            // layer.close(index);
        });
    });

</script>
<script>
    function transInput(){
        //转换航班信息
        $(".airportDiv").each(function(){
            var html = '';
            var airportDetail = $(this).find(".airportDetail").val();
            var airportPrice = $(this).find(".airportPrice").val();
            if(airportDetail!==undefined && airportDetail!==''){
                html += "明细："+airportDetail;
            }
            if(airportPrice!==undefined && airportPrice!==''){
                html += "<br style='mso-data-placement:same-cell;'/> 报价：￥"+airportPrice;
            }
            $(this).parent().html(html);
        });

        //转换酒店信息
        $(".hotelDetail").each(function(){
            var html = '';
            var hotelDetail = $(this).val();
            var hotelPrice = $(this).parent().find(".hotel-dealis").find(".hotelPrice").val();
            var dataNum = $(this).parent().find(".hotel-dealis").find(".hotelPrice").attr("data-num");
            var totalHotelPrice = $(this).parent().find(".hotel-dealis").find(".totalHotelPrice").val();
            if(hotelDetail!==undefined && hotelDetail!==''){
                html += "明细："+hotelDetail;
            }
            if(hotelPrice!==undefined && hotelPrice!==''){
                html += "<br style='mso-data-placement:same-cell;'/> 报价：￥"+hotelPrice+" *"+dataNum+"天 ="+" ￥"+totalHotelPrice;
            }
            $(this).parent().html(html);
        });

        //转换租车信息
        $(".driveDetail").each(function(){
            var html = '';
            var driveDetail = $(this).val();
            var drivePrice = $(this).parent().find(".drivePrice").val();
            if(driveDetail!==undefined && driveDetail!==''){
                html += "明细："+driveDetail;
            }
            if(drivePrice!==undefined && drivePrice!==''){
                html += "<br style='mso-data-placement:same-cell;'/> 报价：￥"+drivePrice;
            }
            $(this).parent().html(html);
        });

        //转换包车信息
        $(".totalCarPrice").each(function(){
            var html = '';
            var totalCarPrice = $(this).text();
            if(totalCarPrice!==undefined && totalCarPrice!==''){
                html += "￥"+totalCarPrice;
            }
            $(this).parent().html(html);
        });

        //转换门票、保险、附加信息
        $(".insuranceDetail,.totalInsurancePrice,.extraDetail,.totalExtraPrice").each(function(){
            var html = '';
            var value = $(this).val();
            var name = $(this).attr("name");
            if(value!==undefined && value!==''){
                if(name=='ticketPrice' || name=='extraPrice' || name=='insurancePrice'){
                    html += "￥"+value;
                }else{
                    html += value;
                }
            }else{
                html += "/";
            }
            $(this).parent().html(html);
        });

        //转换合价
        $("#totalPrice,#count_airportPrice,#count_hotelPrice,#count_drivePrice,#count_carPrice,#count_ticketPrice,#count_insurancePrice,#count_extraPrice,#totalSalePrice,#count_airportSalePrice,#count_hotelSalePrice,#count_hotelSalePrice,#count_carSalePrice,#count_ticketSalePrice,#count_insuranceSalePrice,#count_extraSalePrice").each(function(){
            var html = '';
            var value = $(this).text();
            if(value!==undefined && value!==''){
                html += "￥"+value;
            }else{
                html += "/";
            }
            $(this).parent().html(html);
        });

        //删除设置司导返程
        $(".setReturnJourney").each(function(){
            $(this).remove();
        });

        return true;
    }

    //导出Excel
    //jQuery HTML导出Excel文件(兼容IE及所有浏览器)
    $("#exportExcel").click(function(){
        transInput();
        var filename = $('#name').val();
        filename = filename+"*报价详情";

        var isMac = /macintosh|mac os x/i.test(navigator.userAgent);
        if(isMac){
            new Table2Excel('#summaryPricingTable').export(filename);
        }else{
            $("#summaryPricingTable").table2excel({
                name: "Excel Document Name.xls",
                filename: filename,
                fileext: ".xls"
            });
        }

        setTimeout(function(){
            window.location.reload();
        },1000);

        return false;
    });
</script>
<script src="__PUBLIC__/drag/Sortable.js"></script>
<script>
    $('.dragsort_div').each(function () {
        schedule_id = $(this).parent().find('.schedule_id').val();
        schedule_id = schedule_id+"_did";
        new Sortable( document.getElementById(schedule_id), {
            group: 'shared',
            animation: 350,
            draggable: ".a_div",
            handle: ".radius_div",
            scroll:true,
            forceFallback: true,
            onEnd:function (evt) {
                var active_id = $("#"+evt.item.id).find(".active_id").attr("value");
                var from_schedule_id = $("#"+evt.from.id).parent().parent().find(".schedule_id").attr("value");
                var to_schedule_id = $("#"+evt.to.id).parent().parent().find(".schedule_id").attr("value");
                var to_data_day = $("#"+evt.to.id).parent().parent().find(".schedule_id").attr("data-day");

                var active_id_list = '';
                var childNodes = evt.to.childNodes;
                for(var i=0;i<childNodes.length;i++){
                    var id = childNodes[i].id;
                    if(id!==undefined){
                        id = id.substring(0,id.length-4);
                        active_id_list = active_id_list+","+id;
                    }
                }

                console.log(active_id_list);

                $.ajax({
                    url:"{:url('/admin/quicktrip/changeActiveDay')}",
                    data:{active_id:active_id,schedule_id:to_schedule_id,active_id_list:active_id_list},
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code==1){
                            //当拖拽到不同day时
                            if(from_schedule_id!==to_schedule_id){
                                $("#"+evt.item.id).find(".active_id").attr("data-sid",to_schedule_id);
                                $("#"+evt.item.id).find(".active_id").attr("data-day",to_data_day);
                                $("#"+evt.item.id).find(".activeSelect_slt").attr("data-sid",to_schedule_id);
                            }
                            var prev_id = res.data.prev_id;
                            var next_id = res.data.next_id;
                            if(prev_id>0){
                                getPointDistace(prev_id,from_schedule_id);
                            }
                            if(next_id>0){
                                getPointDistace(next_id,from_schedule_id);
                            }
                            getPointDistace(active_id,to_schedule_id);

                            allSortKeyNum();

                            //如果地图显示状态刷新地图
                            if(visibleMap){
                                //模拟点击显示地图
                                $("#li_"+to_schedule_id).find(".getDayMap").click();
                            }
                        }else{
                            layer.msg(res.msg);
                            setTimeout(function(){
                                //location.reload();
                            },1500);
                            return false;
                        }
                    }
                });

                return false;
            }
        });
    });
</script>

<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('poi_content',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            [ 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough','removeformat']
        ]
    });
    var ue1 = UE.getEditor('content',{
        initialFrameHeight: 100,
        initialFrameWidth: 500,
        toolbars:[
            [ 'source'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough','removeformat']
        ]
    });
    var ue2 = UE.getEditor('newpoi_content',{
        initialFrameHeight: 100,
        initialFrameWidth: 400,
        zIndex:99,
        toolbars:[
            [ 'source'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough','removeformat']
        ]
    });
</script>
</body>
</html>